Skip to content

php autoloading stategy using standart autoloader

Notifications You must be signed in to change notification settings

slatoric/php-autoload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-autoload

php autoloading with standard autoloader

https://github.com/slatoric/php-autoload.git

shows how to use namespaces with ini setting("include_path")

every file that tries to load all library must have one line: require_once([$_SERVER["DOCUMENT_ROOT"].]"[/]ald.php"); in which path to vendor (/vendor/yoursvendor/) added to include_path

be careful because of use $_SERVER["DOCUMENT_ROOT"] variable; however in most cases it exists

this allows to include all classes, interfaces and traits from any directory of site

all namespaces starts from vendor directory

some integration example with FastRoute (better use Composer for auto updates):

https://github.com/nikic/FastRoute

https://packagist.org/packages/nikic/fast-route

for use the router we need to redirect all Not Found requests to index.php in nginx config we can use try_files $uri $uri/ /index.php?$args;

About

php autoloading stategy using standart autoloader

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages