最佳自动加载器。

1.0.1 2023-04-01 07:35 UTC

This package is auto-updated.

Last update: 2024-09-30 01:49:05 UTC


README

下载

Composer

composer require nathanwooten\al

GitHub

https://github.com/nathanwooten/al

使用

加载

<?php

require_once 'al.php';

使用Composer加载

<?php

require_once 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

顶级文件(s)

nathanwooten\al\Al::path_( 'TOP_DIR', [ dirname( __FILE__ ) ] );
nathanwooten\al\Al::path_( 'TOP_FILE', [ 'TOP_DIR', 'top.php' ] );

$return = nathanwooten\al\Al::file_( 'TOP_FILE' );
...

从任何入口点

<?php

use nathanwooten\al\Al;

//... define public ...
//ie:
// PathFind.php is in all dirs
$pathFind = require dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'PathFind.php';
// define public
$public = $pathFind->pathFind( __FILE__, [ 'public_html' ] ) . DS . 'public_html' );
//...

Al::path_( 'PUBLIC_HTML', 'PUBLIC_HTML', $public );
Al::path_( 'TOP_FILE', 'PUBLIC_HTML', 'top.php' );

$containerOrApplication = Al::file_( 'TOP_FILE' );
return $containerOrApplication;

配置

配置是先进先出(FIFO)。

技术上配置可以包括任何函数,但旨在包括Al对象的方法,这些方法以"_"结尾