zuffik / srvant
Data structures and object wrappers for primitive data types
Installs: 165
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:composer
Requires (Dev)
- alphayax/phpdoc_md: ^1.2
- phpunit/phpunit: ^6
README
srvant
srvant is your little but helpful package that improves PHP usability.
Docs
Installation
simply...
composer require zuffik/srvant
Usage
Structures
Lists:
- Array List
- Linked List
Maps:
- Hash map
example:
$list = new ArrayList(); $list->add(1, 2, 3, -1); foreach($list as $item) { echo $item . "\n"; } // And equivalent $list->map(function($item) { echo $item . "\n"; return $item; })->filter(function($item) { return $item > 0; }); // And many more
Full documentation available here.
String
Offers interface with string functions.
example:
$str = string('Hallo world') ->replace('a', 'e') ->lowerCase() ->slugify() ->upperCase(); echo $str; // HELLO-WORLD
Full documentation available here.
Formats
- CSV
- JSON
- Regex
- URL
All of these offer a interface for work with certain data format.
example:
$url = new URL('http://sub.example.com/index.php?action=page'); echo $url->getDomain(); // example echo $url->getRequestedUrl(); // index.php
Full documentation available here.
There are planned many features in future.
Sources
As for mime types, this magic database is used
Contribution
Contribution is simple. Make pull request with your new or edited code. It MUST follow PSR coding standards. For new feature provide also unit tests.
Donate
If you are satisfied with srvant, please donate. Thank you all. :)