Maps JSON files to PHP objects, intended for simple model separation and manual content authoring
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
src/AdamQuaile/JsonObjectMapper
tests
.gitignore
.travis.yml
README.md
composer.json
composer.lock
phpunit.php
phpunit.xml

README.md

JSON Object Mapper

Build Status

Small library to read JSON files from a directory and turn them into PHP objects. Designed for simple content authoring and model separation by developers without the need for a whole DBMS.

Not intended as any kind of DBMS, or application writable persistence layer

Main Features

Installation

composer require adamquaile/json-object-mapper

Usage

Full documentation here

<?php

require __DIR__.'/vendor/autoload.php';

$manager = new \AdamQuaile\JsonObjectMapper\EntityManager('/path/to/storage');

// Either
$book = $manager->find('books/1984');
$book->isbn;
$book->getTitle(); // etc

// or

$books = $manager->findAll('books');
$books[0]->isbn
$books[0]->getTitle() // etc

// or

$books = $manager->findAll('books', $manager->query()->matches('author.name', '/george/i'));
$books[0]->getTitle() // etc