1. Go to this page and download the library: Download makinacorpus/normalization 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/ */
makinacorpus / normalization example snippets
namespace App\Entity;
use MakinaCorpus\Normalization\Alias;
#[Alias(name: "foo")]
class Foo
{
}
namespace App\Command;
use MakinaCorpus\Normalization\Alias;
#[Alias(name: "do_foo", tag: "command")]
class Foo
{
}
namespace App\Command;
use MakinaCorpus\Normalization\Alias;
#[Alias(name: "foo")]
#[Alias(name: "do_foo", tag: "command")]
#[Alias(name: "foo_done", tag: "event")]
class Foo
{
}
namespace App\Command;
use MakinaCorpus\Normalization\Alias;
#[Alias(name: "do_foo", tag: "command")]
#[Alias(name: "older_legacy_name", tag: "command", deprecated: true)]
class Foo
{
}
namespace App\Command;
use MakinaCorpus\Normalization\Alias;
#[Alias(name: "do_foo", tag: "command", priority: 100)]
#[Alias(name: "older_legacy_name", tag: "command", priority: -100)]
class Foo
{
}
return [
// ... Your other bundles.
MakinaCorpus\Normalization\Bridge\Symfony\NormalizationBundle::class => ['all' => true],
];
use MakinaCorpus\Normalization\NameMap\DefaultNameMap;
use MakinaCorpus\Normalization\NameMap\PrefixNameMappingStrategy;
$nameMap = new DefaultNameMap(
new PrefixNameMappingStrategy(
'MyApp',
'My\\Namespace\\Prefix',
)
);
namespace App\Infra\Bus;
use MakinaCorpus\Normalization\NameMap;
class SomeBus
{
public function __construct(
private NameMap $nameMap
{
}
/**
* This is fictional pseudo-code.
*/
public function getClassBusinessName(object $message): void
{
return $this
->nameMap
->fromPhpType(
\get_class($message),
'some_tag'
)
;
}
}
namespace App\Infra\Bus;
use MakinaCorpus\Normalization\NameMap\NameMapAware;
use MakinaCorpus\Normalization\NameMap\NameMapAwareTrait;
class SomeBus implements NameMapAware
{
use NameMapAwareTrait;
/**
* This is fictional pseudo-code.
*/
public function send(object $message): void
{
return $this
->getNameMap()
->fromPhpType(
\get_class($message),
'some_tag'
)
;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.