A simple class instance autoloader for PHP applications.

1.0.2 2022-01-01 07:04 UTC

This package is auto-updated.

Last update: 2022-06-29 08:17:24 UTC


security tests PHPStan PHP CS Fixer StyleCI Build Status codecov Downloads Packagist License Liberapay

Autoloader for custom class instances.


This version supports PHP 8.0. You can install the package via composer:

composer require adrianmejias/veil




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
    '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!


composer test


  • 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


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.


The MIT License (MIT). Please see the license file for more information.