1. Go to this page and download the library: Download maximaster/attributemplate 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/ */
maximaster / attributemplate example snippets
#[Rename(new EvalString('sprintf("Version%s", date("YmdHis"))')]
class MigrationTemplate {
#[SetValue(new Guid())]
public const ID = '';
}
// examples/001/input.php
namespace App;
use Maximaster\Attributemplate\TemplateAttribute\Rename;
use Maximaster\Attributemplate\TemplateAttribute\SetValue;
use Maximaster\Attributemplate\JustScalar\EvalString;
use Ramsey\Uuid\Uuid;
#[Rename(new EvalString('sprintf("Version%s", date("YmdHis"))'))]
class Migration
{
#[SetValue(new EvalString('Uuid::uuid5("namespace", "name")->toString()'))]
public const ID = '';
}
// examples/001/output.php
namespace App;
class Version20230101120000
{
public const ID = '550e8400-e29b-41d4-a716-446655440000';
}
#[Rename(new EvalString('MyDynamicName'))]
class Base {}
// Output: class MyDynamicName {}
#[SetValue(new Guid())]
public const UUID = '';
// Output: public const UUID = '123e4567-e89b-12d3-a456-426614174000';
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.