- FEATURES
-
Autoload
- Class Reflection
- Magic Methods
- Exceptions
- Late Static Binding
- Type Hinting
- SPL
- PHPUNIT
- PHAR
- COMPOSER
- Carbon
- Guzzle
- Faker
- Math
- Requests
- DESIGN PATTERNS
- Singleton Pattern
- Observer Pattern
- Strategy Pattern
- Dependency Injection
- Middleware
- Registry
- SYMFONY
- Routes
- Annotations
- Flex
- Controllers
- Doctrine
- Templating
- VERSIONS
- Php7.4
- Php8.0
- SECURITY
- Filter Input
- Remote Code Injection
- Sql Injection
- Session Fixation
- File Uploads
- Cross Site Scripting
- Spoofed Forms
- CSRF
- Session Hijacking
- MODERN PHP
- Composer
- Autoloader
- Package
- Releases
- Generators
- Dependency Injection
- Middleware
- CUSTOM FRAMEWORK
- App
- Http Foundation
- Front Controller
- Routing
- Render Controller
- Resolver
- SoC
- FRAMEWORKS
- Slim
- Symfony V5
- Laravel V8
- Laminas V3
- Codeigniter V4
Autoload
Autoload facility allows to load classes on-demand.
function __autoload($class) {
require_once str_replace("_", "/", $class);
}
$obj = new Article_Model();
SPL
The Standard PHP Library (SPL) offer a quick solution.
//Register an autoload function
function myAutoLoader($className) {
include("classes/$className.php");
}
spl_autoload_register("myAutoLoader");
//Register another autoload function
function myOtherAutoLoader($className) {
include("include/$className.php");
}
spl_autoload_register("myOtherAutoLoader");
$obj = new MyClass1();
$obj2 = new MyClass2();
Last update: 23 days ago