Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
/ veil Public archive

A simple class instance autoloader for PHP applications.

License

Notifications You must be signed in to change notification settings

adrianmejias/veil

Repository files navigation

Veil

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

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.