Download the PHP package henzeb/var-export-wrapper without Composer

On this page you can find all versions of the php package henzeb/var-export-wrapper. 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 var-export-wrapper

var_export wrapper

Latest Version on Packagist Total Downloads

var_export is a good choice when caching config. This is how it is done in Laravel for example. But not every object is automatically exportable.

Imagine you want to make an ImageManipulationService that resizes your images. You want it to be configurable, so you get something like this:

``

You would need an option for each possible feature, or implement the new wanted feature whenever requested. You could work with invokable classes, but that won't make it readable.

What if you could do this:

``

With this package, you can export closures and objects that do not implement __set_state. You do not need laravel to use it, but when you do, it automatically parses your configuration for artisan config:cache

Installation

Just install with the following command.

Usage

exportify

exportify is what wraps the object or an array of objects ``

Note: exportify also iterates through objects implementing Traversable or ArrayAccess.

__get_state

exportify does not automatically wrap properties inside the object, and this is fine in most cases. But sometimes you want to export objects such as closures inside an object, or specify what to export. in order to do that, you can implement __get_state on your object. This method should return an array with the properties you want to restore with __get_state.

``

Note: you do not need to use exportify here yourself, it is done automatically.

is_exportable

Validates the given object or array. If not exportable, it returns false.

``

var_export

var_export is the supercharged version of the native function, but under the hood it will automatically wrap everything that is not exportable by default in a VarExportable instance, before actually exporting the value.

``

var_export_file

var_export_file is the same as var_export, but it exports to a file instead of returning.

``

var_import

var_import is useful when you want to import a var_exported string or file. This function will automatically unwrap the VarExportable instances. You can also pass an array that was imported in another way, but still contains VarExportable instances.

``

Laravel Config

When installed in a Laravel installation, you can just start using closures and objects inside your configuration. When calling artisan config:cache, var_export wrapper automatically wraps them in a wrapper.

Closures under the hood

To be able to export closures, it has to serialize them. It uses laravel/serializable to achieve that. This means that if you've set a secret key, the closure is signed, otherwise it's natively serialized and thus unsigned.

You do not need to wrap closures before passing them to exportify

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The GNU AGPLv. Please see License File for more information. ]()


All versions of var-export-wrapper with dependencies

PHP Build Version
Package Version
Requires laravel/serializable-closure Version ^v1.3
php Version ^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 henzeb/var-export-wrapper contains the following files

Loading the files please wait ....