Download the PHP package imponeer/toarray-interface without Composer
On this page you can find all versions of the php package imponeer/toarray-interface. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download imponeer/toarray-interface
More information about imponeer/toarray-interface
Files in imponeer/toarray-interface
Package toarray-interface
Short Description A PHP interface defining a standard method for converting objects to arrays. Ensures consistent method naming and return type for array conversion across different classes.
License MIT
Homepage https://github.com/imponeer/toarray-interface
Informations about the package toarray-interface
ToArray Interface
Some long time ago there were RFC about adding __toArray method into PHP. Sadly, this was rejected. PHP-FIG doesn't have yet any project about that. And that's why today we have many classes in different frameworks that has toArray method. There are some composer packages that has toArray interface like illuminate/contracts. However these packages are not very good choice if you need only one file with interface from there. In that case they have many things that you do not need. So, that's why we have created small composer library that could be used for such cases.
So, basically this library is only for one thing - it gives interface that could be used when you need to know if object has possibility to be converted to array with toArray
method.
Installation
To install and use this package, we recommend to use Composer:
Otherwise you need to include manualy files from src/
directory.
Note: if you need to use this library in PHP 5 project, you need use 1.0 version of this library.
Example
How to contribute?
If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try interactive GitHub tutorial.
If you found any bug or have some questions, use issues tab and write there your questions.