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.

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 toarray-interface

GitHub release PHP Packagist

ToArray Interface

There have been several attempts to introduce a standard toArray method or interface in PHP:

This package was created to address this gap: it provides a minimal Composer package containing only the ToArrayInterface. Use it when you need to ensure an object can be converted to an array via a toArray method, without introducing unnecessary dependencies.

Installation

To install and use this package, use Composer:

Alternatively, manually include the files from the src/ directory.

Note: For PHP 5 projects, use version 1.0 of this library.

Example

Documentation

This repository features an automatically updated GitHub Wiki containing up-to-date code documentation generated from the source. You can use the Wiki to explore interfaces, methods, and other technical details about the project.

Alternatives

Because PHP does not yet have a standard way to convert objects to arrays, many alternative libraries exist, each trying to solve the same problem in its own way. Depending on your specific needs - such as recursion support, fluent APIs, strict interface contracts, or framework integration - you may find one of these packages better suited for your project.

Below is a curated list of popular alternatives, showcasing different approaches to object-to-array conversion in PHP:

Package PHP Version Features
inspirum/arrayable PHP Recursive conversion, helper functions, base classes
dmytrof/array-convertible PHP Lightweight, nested conversion, simple interface
rexlabsio/array-object-php PHP Fluent interface, toArray() and toJson() methods
php-extended/php-arrayable-interface PHP Interface-only, strict contract definition
illuminate/contracts PHP Defines a generic Arrayable interface usable with or without Laravel

Missing an alternative? Submit a pull request to get it added.

Development

To maintain code quality, this project uses:

Running PHPCS

Run the following command to check code style:

Running PHPStan

Run the following command to perform static analysis:

Refer to phpcs.xml and phpstan.neon for configuration details.

How to contribute?

Contributions are welcome! To contribute:

  1. Fork this repository on GitHub.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and commit them with clear messages.
  4. Push your branch to your fork and open a Pull Request.

If you find a bug or have a question, please use the issues tab.


All versions of toarray-interface with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
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 imponeer/toarray-interface contains the following files

Loading the files please wait ....