brokencube / automatorm
This package is abandoned and no longer maintained.
No replacement package was suggested.
Simple schema-led ORM, with no code generation required
6.2.3
2018-04-18 11:30 UTC
Requires
- php: >=7.0.0
- psr/cache: ^1.0
- psr/log: ^1.0
- psr/simple-cache: ^1.0
Requires (Dev)
- phpunit/php-code-coverage: ^6.0
- phpunit/phpunit: ^7.0
This package is not auto-updated.
Last update: 2022-05-14 04:02:31 UTC
README
A simple to use ORM in PHP, that reads your database schema directly, without having to run code generators, or create schema documents.
Installation
$ composer require brokencube\automatorm
Requirements
PHP 7.0 + PDO (Currently only MySQL supported - expect to support other engines in the future)
Basic Example
<?php use Automatorm\Orm\{Model,Schema}; use Automatorm\DataLayer\Database\Connection; // Class that is linked to the table "blog" - namespace is linked to a particular schema + connection namespace models { class Blog extends Model {} } // Get db connection $connection = Connection::register($pdo); // Get db schema for the ORM and assign to 'models' namespace as above Schema::generate($connection, 'models'); // Find a table row based on a simple where clause $blog = Blog::find(['title' => 'My Blog']); // Select * from blog where title = 'My Blog'; echo $blog->id; // Prints "1" echo $blog->title; // Prints "My First Entry"
A more detailed layout of how to use the ORM can be found in the Wiki