isholao / container
PHP Container
1.0
2017-11-21 04:50 UTC
Requires
- php: >=7.1.0
- psr/container: 1.*
Requires (Dev)
- phpunit/phpunit: v6.4
This package is not auto-updated.
Last update: 2025-05-11 08:18:51 UTC
README
Install
To install with composer:
composer require isholao/container
Requires PHP 7.1 or newer.
Usage
Here's a basic usage example:
<?php require '/path/to/vendor/autoload.php'; $c = new \Isholao\Container\Container(); $c->set('name','ishola'); // $c->name = 'ishola'; if($c->has('name')) { echo $c->get('name'); // $c->name; } $c->protected('response', function (){}); $c->response();
Protecting an item. Define it will the protect method
<?php require '/path/to/vendor/autoload.php'; $c = new \Isholao\Container\Container(); $c->protect('name','ishola'); $c->name = 'ishola'; // throw error