A standalone PHP utility library. Inspired heavily by similar projects like libphutil. Currently used in personal and work projects. Designed to make working wth PHP a little bit nicer and predictable.
Requires HHVM 3.6 or PHP 5.6
- Provide a consistent API for common operations.
- Gather the most useful bits and snippets under one library.
- Strong emphasis on strict type checking (e.g.
float !== integer
). - Functional programming ideas and concepts are welcome (I'm new to this).
While Nucleus has a bunch of random crap in it, there are some useful classes worth mentioning:
- Spec: A multi-purpose constraint checking framework that can be easily extended.
- Validator: Built upon Spec, the Validator component provides an interface for generating UX-friendly messages for a SpecResult.
- Impersonator: A constructor dependency automocker. Useful for testing classes that have many external dependencies and projects that heavily use container dependency injection.
- View: An set of classes and utilities for generating clean and safe HTML/Text. It sort of looks like XHP without the XML or de-sugarized React.js code.
- Std, Arr, and others: We all know the PHP standard library is a mess. There are many failed attempts to fix this out there. This is another one of those attempts. I've created a few classes with a bunch of static aliases that attempt to improve upon it. Yes, there is a performance penalty (validation + at least one more function call), but it makes many operations more predictable and safer.
cd docs
pip install -r requirements.txt
make html
Pull requests are accepted on GitHub. Bug fixes and small improvements are welcome. Big ideas will be reviewed and discussed.
Code Standard: PSR-2 with some additions. See https://github.com/sellerlabs/php-standard for more details.
This code is licensed under the MIT license. See LICENSE for more information.