mi / metadata-puli-file-locator
Puli-FileLocator for JMS Metadata
Installs: 3 730
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.0
- jms/metadata: ~1.5.0
- puli/discovery: ^1.0@beta
- puli/repository: ^1.0@beta
Requires (Dev)
- jms/serializer: ^1.0
- phpunit/phpunit: ^4.7
- symfony/filesystem: ~2.7.0
This package is not auto-updated.
Last update: 2020-02-07 09:31:33 UTC
README
Overview
...
Installation
- Add this library to your project as a composer dependency:
composer require mi/metadata-puli-file-locator
Usage
PuliDiscovery
For the usage of the puli discovery file locator use the PuliDiscoveryDriverFactory. To configure the metadata bind the query to "jms/serializer-metadata" with the parameter for the namespace prefix and the extension.
php puli.phar bind /puli/path/to/file/*.xml jms/serializer-metadata --param extension="xml" \ --namespace-prefix="Vendor\Namespace\Prefix"
$serializer = JMS\Serializer\SerializerBuilder::create() ->setMetadataDriverFactory(new Mi\Puli\Serializer\Builder\PuliDiscoveryDriverFactory($puliDiscovery)) ... ->build();
PuliRepository
For the usage of the puli repository file locator use the PuliRepositoryDriverFactory. Also the metadata are configure with the puli paths and namespace prefix.
$serializer = JMS\Serializer\SerializerBuilder::create() ->addMetadataDir('/puli/path/to/file', 'Vendor\Namespace\Prefix') ->setMetadataDriverFactory(new Mi\Puli\Serializer\Builder\PuliRepositoryDriverFactory($puliRepository)) ... ->build();
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
This library is under the MIT license.