此包已被废弃,不再维护。未建议替代包。

PHP应用程序的简单类实例自动加载器。

1.0.2 2022-01-01 07:04 UTC

This package is auto-updated.

Last update: 2024-04-29 04:40:59 UTC


README

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

自定义类实例的自动加载器。

安装

此版本支持PHP 8.0。您可以通过composer安装此包

composer require adrianmejias/veil

用法

示例

<?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() . '!';

预期输出

Hello, world!

测试

composer test

待办事项

  • 添加到packagist仓库
  • 添加单元测试
  • 为开源贡献添加文档
  • 添加GitHub Action进行单元测试
  • 添加更多单元测试覆盖率
  • 向README.md添加更多文档
  • 向README.md添加API列表

贡献

感谢您考虑为Veil做出贡献!您可以在此处阅读贡献指南。

行为准则

为了确保社区对所有成员都持欢迎态度,请查阅并遵守行为准则

安全漏洞

有关更多信息,请参阅安全文件

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件