1. Go to this page and download the library: Download galactium/space library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
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' => '[email protected]',
'name' => 'My Name'
]
]));
// create your first message:
$mailManager->message()
->to('[email protected]')
->subject('Subject')
->body('Text')
->send();
// create using a volt template:
$mailManager->message()
->view('volt-template', [
'user' => Users::findFIrst()
])
->to('[email protected]')
->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('[email protected]')
->subject('Subject')
->send();
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);
use Galactium\Space\Seo\Manager;
$seoManager = new Manager();
$seoManager->breadcrumbs()->push('title','/link');
$seoManager->get(); // returns Galactium\Space\Seo\Breadcrumbs\Breadcrumb[]
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();
}
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');
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.