Download the PHP package harm-less/php-encoder without Composer
On this page you can find all versions of the php package harm-less/php-encoder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download harm-less/php-encoder
More information about harm-less/php-encoder
Files in harm-less/php-encoder
Package php-encoder
Short Description Encoder to intelligently convert an entire PHP object to Json or XML e.g.
License MIT
Homepage https://github.com/harm-less/php-encoder
Informations about the package php-encoder
php-encoder
php-encoder is a fast & flexible encoder for PHP 5.3+
About
This library will allow you to save a snapshot of your PHP object in various formats like XML or JSON (encoding). When your project has been setup properly you can reuse the snapshot by decoding it. The decoding process will return the same PHP object you started with.
This library is useful for you if you want to quickly find a way to save a state of your PHP object. Think about a configurator that allows you to customize a certain product in various ways for example.
Getting started
- PHP 5.3.x is required
- Install php-encoder using Composer (recommended) or manually
- Set up the nodes you need for your PHP objects
Composer Installation
- Get Composer
- Require the encoder with
composer require harm-less/php-encoder
- Add the following to your application's main PHP file:
require 'vendor/autoload.php';
Included encoders
There are currently 2 encoding types available: XML and JSON. Both can be used interchangeably as long as you have set up your nodes correctly.
Example
Hello World - Obligatory hello world example
Unit Testing
This project uses PHPUnit as its unit testing framework.
The tests all live in /tests
and each test extends an abstract class
AbstractPETest
To test the project, simply run composer install --dev
to download
a common version of PHPUnit with composer and run the tests from the main
directory with phpunit
or ./vendor/bin/phpunit