Download the PHP package brightnucleus/phpfeature without Composer
On this page you can find all versions of the php package brightnucleus/phpfeature. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpfeature
PHPFeature
PHPFeature is a first draft of a PHP Feature Detection Library similar to what Modernizr does for the browser features. So, instead of checking for a specific PHP version number (which forces you to know which and compare which features were introduced by which versions), you can simply tell the library what features you need, and it will tell you with a simple boolean value whether these are supported or not.
You can read more background information here: http://www.alainschlesser.com/php-feature/
Table Of Contents
- Requirements
- Installation
- Basic Usage
- Known Issues
- Contributing
- License
Requirements
To develop using the library, you will need PHP 5.3.2+, as it uses Composer to manage its dependencies.
However, the runtime code only requires PHP 5.2+, as one of the goals was to make it useful for WordPress development.
Installation
To include the library in your project, you can use Composer:
Alternatively, you can copy the classes inside of your application and make sure that your application can find them.
Basic Usage
Usage is pretty simple, it only comes with two methods so far.
This returns a boolean value telling you whether all of the features that you passed in are supported by the current PHP version.
This returns a SemanticVersion object that contains the minimum PHP version that supports all of the features that you passed in.
Here’s an example of how to use it to stop execution and inform the user:
Known Issues
-
The library currently uses PHP's
version_compare()
to make the actual comparison. This should probably be done by a real SemVer comparison algorithm. -
The list of features is not yet exhaustive. There should also be some guidelines to know how these are named.
- The algorithm behind
get_minimum_required()
is still very basic, andNotEqual
is not implemented.
Contributing
All feedback / bug reports / pull requests are welcome.
License
This code is released under the MIT license. For the full copyright and license information, please view the LICENSE file distributed with this source code.
All versions of phpfeature with dependencies
brightnucleus/config-52 Version ^0.1
brightnucleus/php-releases Version ^0.1