Skip to content

w6cloud/php-class-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WEB6 PHP Class Collection Trait

Organize classes in folders and auto/lazy load them as attributes.

Install

Install via Composer

$ composer require web6/class-collection

Usage

Configure autoload

Configure autoloading by including Composer's generated file :

include_once('vendor/autoload.php');

Create member classes

Create classes and save them in a folder.

class App {

    use \W6\ClassCollection\ClassCollectionTrait;

    public $message = 'Not inited';

    protected function init() {
        $this->message = 'Inited';
    }
}

Use your class

Anywhere in your application you can request the same instance of the class.

$app = App::instance();
echo $app->message;

About

Organize classes in folders and auto/lazy load them as attributes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages