dakujem / cumulus
โ A set of utilities for easier development of cloud-enabled software.
Installs: 26 030
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
Requires (Dev)
- nette/tester: ^2.4.1
- tracy/tracy: ^2.8.9
README
A set of plug-in utilities for easier development of cloud-enabled software.
๐ฟ
composer require dakujem/cumulus
๐ Changelog
Documentation
Included classes:
Pipeline
- ๐ Middleware and Pipelines
- a class for middleware and pipelines
Dsn
- ๐ Data Source Name
- a DSN configuration wrapper and parser
LazyIterator
- ๐ LazyIterator
- an iterator for on-demand data provisioning
As of now, the library has no external dependencies.
Compatibility
Examples
Pipelines & middleware
$foobarSuffixTube = Pipeline::tube([ function (string $a): string { return $a . 'foo'; }, function (string $a): string { return $a . 'bar'; }, ]); $foobarSuffixTube('iam'); // 'iamfoobar' $foobarPrefixMiddleware = Pipeline::onion([ function (string $a, callable $next): string { return $next('bar' . $a); }, function (string $a, callable $next): string { return $next('foo' . $a); }, ]); $foobarPrefixMiddleware('youare'); // 'foobaryouare'
More in the documentation here: Middleware and Pipelines.
Dsn
$dsn = new Dsn('mysqli://john:secret@localhost/my_db'); // with optional default values $driver = $dsn->get('driver', 'mysqli'); $port = $dsn->get('port', 3306); // without optional defaults $user = $dsn->get('username'); // using magic and array accessors: $user = $dsn->username; $user = $dsn['username']; $pass = $dsn->password ?? '';
More in the documentation here: Dsn (Data Source Name).
Testing
Run unit tests using the following command:
$
composer test
Contributing
Ideas or contribution is welcome. Please send a PR or file an issue.