Skip to content

PHPallas/Buffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buffer

A Stock to keep variables and function and use them inside a pipiline system. This package is originally created to work alongside various packages by PHPallas Team. However, it is possible to use it anywhere you need a buffer object to keep your variables and functions available across steps of a pipeline.

How to

  1. Install phpallas/buffer: by using composer you can install it on your package as below:
composer require phpallas/buffer

This will install latest version of package.

  1. Get an instant: buffer is a singleton so inside and part ot your program get the instant as following method:
use PHPallas\Buffer\Stock as Buffer;

$buffer = Buffer::getInstance();
  1. Set variable: you can set a variable as below
use PHPallas\Buffer\Stock as Buffer;

$buffer = Buffer::set("namespace.name", "value here");

where the name of variable MAY include some namespaces using a dot notation, for example vars.page.title, tables.main.headers, etc.

  1. Get variable: you can use a dot notation to get variable value. For example if you set an array as below:
$buffer -> set("page.title", ["title" => "great", "subTitle" => "awsome title", "separator" => "|"]);

then:

$buffer -> get("page.title.title"); // => gerat
$buffer -> get("page.title.subTitle"); // => awsome title
$buffer -> get("page.title"); // => ["title" => "great", "subTitle" => "awsome title", "separator" => "|"]

Feature Request

If you need a feature that is missing from my package just create an isset.

Contribution

All types of contributions (development, test, translation) are welcome! you can contribute on this package and make it better and more usable.

License

This package is licenced under MIT.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages