Simple php toolbox for not to reinvent the wheel!
Every day, we write the same functions for our different projects.
This library contains a multiple functions so as not to have to write them each time.
It also brings some advantages:
- All functions is tested by phpunit
- The functions are organized in a structured way in special classes.
You can use a single class with a simplenew classOne()
or access the different class by a main class (useful for declaring as a service in a framework) - A documentation with phpdoc
- php 7.3 or higher, if you use a lower version see BRANCHES.md
Download whith composer :
composer require cyberomulus/php-toolbox:1.2.*
For use a single class, you can simply create an instance to use it.
For example, use the functions of manipulation and verification of texts:
$textManip = new Cyberomulus\PhpToolbox\Text();
$bool = $textManip->startWith("simple example", "example");
If you use a framework, a good practice is to declare this lib as a service.
In order not to have to declare as many services as class, a class provider exists: Cyberomulus\PhpToolbox\PhpToolbox\
.
Once the service is created, you will have access to each class containing the functions:
$textManip = $this->getService("phpToolBox")->getText();
$bool = $textManip->startWith("simple example", "example");
If you use Symfony >4.0 you can use the bundle cyberomulus/phpToolboxBundle for inject this class in a service.
- PhpToolbox : This class contains a getter for each of the individual classes. If you want to use this lib as a framework service, you can declare this class to use a single service
- Text : This class contains useful functions for manipulating and verifying text
- IO : This class contains useful functions for read and write (on filesystem, console, network)
- Datetime : This class contains useful functions for manipulate date, time and timezone
All functions have a phpdoc and doc inline.
You can request a new function in issue
Your pull requests are welcome!!
Sharing is the strength of this lib.
Please read branches schema and simply:
- fork from
master
- create pull request to
master
- Cyberomulus
This library is open-source software licensed under the MIT license.