PHPackages                             galactium/space - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. galactium/space

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

galactium/space
===============

Galactium Space

v0.4.6(1y ago)090Apache-2.0PHP

Since Sep 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/galactium/space)[ Packagist](https://packagist.org/packages/galactium/space)[ Docs](https://galactium.io)[ RSS](/packages/galactium-space/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (1)Versions (9)Used By (0)

Galactium Space
===============

[](#galactium-space)

[![Codacy Badge](https://camo.githubusercontent.com/0e6f9c3acd3cd983251f36791800a85c5cc7b2be3c7ee05bec9fb347f90beaca/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3937613534333631373230653430386239376466316462323635623865393533)](https://www.codacy.com/app/grigoriy.ivanov.on/space?utm_source=github.com&utm_medium=referral&utm_content=galactium/space&utm_campaign=Badge_Grade)

Galactium Space is a light library to provide extended functionality for Galactium projects.

### Requirements

[](#requirements)

- PHP 7.1 or above
- Phalcon 3.3

### Installation

[](#installation)

```
composer require galactium/space
```

Components
----------

[](#components)

### Translation

[](#translation)

New Translation Adapter: **NestedArray**:

- implements \\JsonSerializable interface:

```
use Galactium\Space\Translation\Adapter\NestedArray;

$messages = [
    'title' => [
        'message' => 'Welcome'
    ],
];

$adapter = new NestedArray([
    'content' => $messages,
]);

json_encode($adapter->toArray());
```

- supports "dot"-navigation:

```
use Galactium\Space\Translation\Adapter\NestedArray;

$messages = [
    'title' => [
        'message' => 'Welcome'
    ],
];

$adapter = new NestedArray([
    'content' => $messages,
]);

 echo $adapter->_('title.message'); // prints Welocme
```

**Translation Manager**

- Supports fallback language;
- Supports Loader to load translations

```
use Galactium\Space\Translation\Loader\File;
use Galactium\Space\Translation\Manager;

$mainLanguage = 'en';
$fallbackLanguage = 'ru';

$translationManager = new Manager(new File('/path/to/messages/dir/'), $mainLanguage, $fallbackLanguage);
```

- Supports hierarchically messages directories:

```
/resources
    /messages
        /en
            /Module
                Common.php
                Edit.php

```

```
$mainLanguage = 'en';
$fallbackLanguage = 'ru';

$translationManager = new Manager(new File('/recourses/messages/'), $mainLanguage, $fallbackLanguage);

$translationManager->loadTranslation('Module::Common'); // to load only /recourses/messages/en/Module/Common.php
```

If you don't need multiple language files in `Module` directory, you can put to them translation file with the same name:

```
/resources
    /messages
        /en
            /Module
                Module.php

```

- All lodaded translations are returned in single NestedArray adapter:

```
$translationManager->getLoadedTranslations() // return Galactium\Space\Translation\Adapter\NestedArray
```

> Please note: Translation Manager works only with NestedArray Adapter.

### Mail

[](#mail)

Mailer wrapper of [swiftmailer/swiftmailer](https://github.com/swiftmailer/swiftmailer).

```
use Galactium\Space\Mail\Manager;
use Phalcon\Config;

$transport = (new \Swift_SmtpTransport('smtp.service.com', 465, false))
    ->setUsername('user_name')
    ->setPassword('user_password');

$mailer = new \Swift_Mailer($transport);

$manager = new Manager($mailer, $transport, new Config([
    'views_dir' => '/path/to/views/dir/',
    'from' => [ // define a global 'from'
        'email' => 'example@test.com',
        'name' => 'My Name'
    ]
]));
```

```
// create your first message:
$mailManager->message()
            ->to('test@test.com')
            ->subject('Subject')
    	    ->body('Text')
    	    ->send();
```

```
// create using a volt template:
$mailManager->message()
            ->view('volt-template', [
                'user' => Users::findFIrst()
            ])
            ->to('test@test.com')
            ->subject('Subject')
    	    ->send();
```

```
// you can pass a callback to manipulate the view instance:
$mailManager->message()
            ->view('volt-template', [
                'user' => Users::findFIrst()
            ], function (ViewBaseInterface $view) {
			// code here ...
            })
            ->to('test@test.com')
            ->subject('Subject')
    	    ->send();
```

You can use `{{ _message }}` to get access to Message instance in your template. For example, it can be used to insert an image as embed content:

```

```

### Identifier

[](#identifier)

The identifier has been developed to easily convert a model's key params (like module, namespace, table name, identity field, and it's value) to string. Identifier Manager can generate GUID (Galactium Unique Identifer) in format: `module::namespace.class.dotted.params`for a model which implements `Galactium\Space\Identifier\IdentifiableInterface` interface.

```
class Model implements IdentifiableInterface {
    public const MODULE_NAME = 'Module'
    public $id;
}

class Guids implements IntercatorInterface {
    public $guid;
}

$record = Model::findFirst(1);

$idetifier = (string) $record->identify(); // return 'module::namespace.model.id.1'

$guid = Guids::findFirst(1);

$interactedRecord = $guid->interacte() // same that Model::findFirst(1);
```

By default Identifer supports only Galactium's class structure.

### Errors Manager

[](#errors-manager)

Errors Manager provide a simple error handling for an app. It is used to catch all exceptions generated by an app and converting them to beautiful response.

### Seo

[](#seo)

Seo Component includes:

- Breadcrumbs

    ```
    use Galactium\Space\Seo\Manager;

    $seoManager = new Manager();

    $seoManager->breadcrumbs()->push('title','/link');

    $seoManager->get(); // returns Galactium\Space\Seo\Breadcrumbs\Breadcrumb[]
    ```
- Meta information

    ```
    use Galactium\Space\Seo\Manager;

    $seoManager = new Manager();

    $seoManager->metas()
                ->add(new Titile('Title'))
                ->add(new Description('Description'))
                ->add(new Keywords('Keywords'))
                ->add(new Canonical('/canonical'));

    foreach($seoManager->metas() as $meta){
        echo $meta->render();
    }
    ```
- OpenGraph

    ```
    use Galactium\Space\Seo\Manager;

    $seoManager = new Manager();

    $seoManager->openGraph()
               ->setType('opengrpah.type')
               ->setTitle('title')
               ->setDescription('description')
               ->if($item->hasImage(), function ($openGraph) use ($item) {
                   $openGraph->setImage($item->getImage()->getSrc());
               })
               ->setUrl('/href');
    ```
- SchemaOrg (Factory for [Spatie\\SchemaOrg](https://github.com/spatie/schema-org))

You can get access to all components listed above using `Galactium\Space\Seo\Manager`.

### Other improvements

[](#other-improvements)

- `\Galactium\Space\Mvc\Model` has a special field `$append` You can easily overwrite or add any attribute to json.

```
class Model {
    protected $append = [
        'full_name'
    ];
    public $id;
    public $first_name;
    public $last_name;

    public function getFullName()
    {
        return "{$this->first_name} {$this->last_name}";
    }

}
json_encode(Model::findFirst()); //returns all attrubutes and result of getFullName() method.
```

> Please note: For some reasons `$append` doesn't work in some cases.

License
-------

[](#license)

This library is licensed under the Apache 2.0 License - see the [LICENSE.md](LICENSE) file for details.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~351 days

Recently: every ~507 days

Total

7

Last Release

724d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13166748?v=4)[Grigoriy Ivanov](/maintainers/grigoriy-ivanov)[@grigoriy-ivanov](https://github.com/grigoriy-ivanov)

---

Top Contributors

[![grigoriy-ivanov](https://avatars.githubusercontent.com/u/13166748?v=4)](https://github.com/grigoriy-ivanov "grigoriy-ivanov (19 commits)")

---

Tags

libraryphalconspacegalactium

### Embed Badge

![Health badge](/badges/galactium-space/health.svg)

```
[![Health](https://phpackages.com/badges/galactium-space/health.svg)](https://phpackages.com/packages/galactium-space)
```

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69938.4M140](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

347.8M3](/packages/dekor-php-array-table)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
