Download the PHP package mathieutu/exporter without Composer

On this page you can find all versions of the php package mathieutu/exporter. 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 exporter

Exporter: Export the attributes you need from all your objects and arrays.

Build Status Quality Score Code Coverage Total Downloads Latest Stable Version License

Installation

Require this package with composer:

Use cases

Because pictures are worth thousands words:

The Exporter package let you write this:

instead of that:

For example, I use it a lot with Laravel Eloquent Resources, or as an easier alternative of Symfony Normalizer:

Usage

Use the \MathieuTu\Exporter\Exporter trait on your classes. You also can use directly the \MathieuTu\Exporter\ExporterService::exportFrom($exportable, $attributes) static method on basic arrays or objects, or if you can't add the trait.

You can export from arrays, objects with ArrayAccess interface, or any standard objects.

The response will be a Laravel Collection (but you absolutely don't need Laravel, this package is totally framework agnostic). If you don't know how to use collections, you can use it exactly like an array, or use toArray() method to get a real one.

Examples

(You can find all this examples and more in the package tests)

For the examples, and to cover all the possible ways to use this package, we'll consider this object as input:

and a standard array as output (in comment), instead of a Collection (result from the $collection->toArray() method).

Export public and private (with getter) root attributes

Export from nested array/object

Set an alias as key:

Export result of a function

License

This Exporter package is an open-sourced software licensed under the MIT license.

Contributing

Issues and PRs are obviously welcomed and encouraged, both for bugs and new features as well as documentation. Each piece of code added should be fully tested, but we can do that all together, so please don't be afraid by that.


All versions of exporter with dependencies

PHP Build Version
Package Version
Requires php Version >= 8.1
ext-json Version *
illuminate/collections Version *
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 mathieutu/exporter contains the following files

Loading the files please wait ....