adrianmejias / veil
A simple class instance autoloader for PHP applications.
Fund package maintenance!
adrianmejias
Ko Fi
Liberapay
paypal.me/adrianmejias
Requires
- php: ^8.0
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.4
- mockery/mockery: ^1.4
- nunomaduro/collision: ^5.10
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/php-code-coverage: ^9.2
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-04-29 04:40:59 UTC
README
Autoloader for custom class instances.
Installation
This version supports PHP 8.0. You can install the package via composer:
composer require adrianmejias/veil
Usage
Example
<?php require_once __DIR__ . '/vendor/autoload.php'; use AdrianMejias\Veil\Veil; // Register the autoloader $veil = (new Veil)->register(); // An example when setting up a flolder and composer psr-4 // autoload is setup as: "Veils\\": "src/Veils/" // FooVeil class extends VeilAbstract with instance of loadable class $veil->add([ 'Foo' => Veils\FooVeil::class, // The alias name and abstract class to alias against. ]); // $veil->add('Foo', Veils\FooVeil::class); // An example if the bar method in the Foo class returned 'world' echo 'Hello, ' . \Foo::bar() . '!'; // use Foo; // ... // echo 'Hello, ' . Foo::bar() . '!';
Expected Output:
Hello, world!
Testing
composer test
Todo
- Add to packagist repo
- Add unit tests
- Add documentation for open source contributations
- Add GitHub Action for unit tests
- Add more unit test coverages
- Add more documentation to README.md
- Add API listing to README.md
Contributing
Thank you for considering contributing to Veil! You can read the contribution guide here.
Code of Conduct
In order to ensure that the community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
Please see the security file for more information.
License
The MIT License (MIT). Please see the license file for more information.