sicram / automapper
A simple library to map objects
0.0.5
2023-05-17 22:23 UTC
Requires
- json-mapper/json-mapper: ^2.17
README
Introduction
TODO: A simple library to map objects.
Getting Started
- Install the library using composer:
composer require sicram/automapper
- Register the library in your provider:
use Sicram\Automapper\Automapper; use Sicram\Automapper\IAutomapper; $this->app->bind(IAutomapper::class, Automapper::class);
- Example of usage:
use Sicram\Automapper\IAutomapper; class ExampleController extends Controller { public function __construct(private IAutomapper $_automapper) { } public function index() { $source = new Source(); $source->name = 'John'; $source->age = 20; $destination = $this->_automapper->map($source, Destination::class); return $destination; } } # Build and Test You can use the following class to build a test with doubles: ```php use Sicram\Automapper\Tests\Supports\Doubles\Automapper\StubAutomapper;
Contribute
TODO: Explain how other users and developers can contribute to make your code better.