Download the PHP package ahmedzidan/php-value without Composer

On this page you can find all versions of the php package ahmedzidan/php-value. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-value

Latest Stable Version License Total Downloads

Value

Modern replacement for PHP’s gettype function.

Installation

Open a terminal, enter your project directory and execute the following command to add this package to your dependencies:

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Usage

The Value class currently contains a single static method called getValue and constants with the names of each of PHP’s types, corresponding to the values returned by the getValue method. There are currently no plans to extend this API and the following functionality is considered feature complete unless new types are added or old ones are removed.

The above will output the following:

This output corresponds to the available constants in the class with the exception for the concrete class names and the additionally available callable and iterable pseudo type names:

The method comes in very handy during the creation of error messages. One of the most repeated patterns in the PHP world is the following:

Which is not only cumbersome but also produces inconsistent type names due to PHP’s inconsistent gettype function. This can be replaced with the method provided by this library.

The method never throws anything and does not emit errors. The sole goal of this tiny library is to keep code DRY as much as possible, after all, it is one of the most important principle of them all.

I tried to get this change into PHP core but it was rejected, see PHP RFC: var_type and the linked resources at the bottom for more details.


All versions of php-value with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6 || ^7.0 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ahmedzidan/php-value contains the following files

Loading the files please wait ....