Download the PHP package stolfam/utils-php8 without Composer
On this page you can find all versions of the php package stolfam/utils-php8. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stolfam/utils-php8
More information about stolfam/utils-php8
Files in stolfam/utils-php8
Package utils-php8
Short Description PHP classes which may help and save your time.
License MIT
Informations about the package utils-php8
PHP 8 Utils
Bunch of helpful classes, interfaces, traits.
- E-mail (gives you domain of email)
- Person, Name (automatically separates first and last name)
- Comparator + interface Comparable
- Sorter (using our Comparable interface)
- Messenger, Message
- Pair, Array
- cached data storage (useful for complex repositories)
- interface Databaseable
- simple Cron (queue of definable tasks)
Using
This is an introduction of some features included in this bundle.
Databaseable
This interface is useful for preparing data for saving into a database.
Cached Data Storage
If you want to speed up your system, a cache is probably one of the way which you may choose. Using is very easy. Look at the example below.
Example
Hint: It is very useful in complex repositories, when some data depend on other data and you are able to speed up whole system, because you load only changed data.
Dependency
That is very useful for multi-level caching of data structures. For example: Imagine that you have a data object called X compounded from smaller data objects A, B and C coming from different resources. For a better speed of a system it is good to use cache for each small object A, B and C and to create dependency between these small objects and the big one X, which would be in the cache as well. This will cause that if change any of the small objects - only that object would be need to reload. After it, the big one will be created from two small from the cache and third (now reloaded) also from cache. At the end the big one X will be stored in the cache as well again until any of the smaller objects will change.
Example
Because of a child changed, all dependent data (a child, a parent and a grandparent) have become invalid and will be overridden with a newer version of data.
Cron
This is a very simple class
for creating a queue of tasks. You can basically create only one file run.php
with tasks definition and execute only that.