bradchesney79 / propel3
High performance data-mapper ORM with optional active-record traits for RAD and modern PHP 7.1+
Requires
- php: >=7.1
- bramus/monolog-colored-line-formatter: ~2.0
- gossi/php-code-generator: dev-master
- marcj/topsort: 1.1.0
- mustache/mustache: ~2.6
- psr/log: ~1.0
- symfony/config: ^3.0
- symfony/console: ^3.0
- symfony/event-dispatcher: ^3.0
- symfony/filesystem: ^3.0
- symfony/finder: ^3.0
- symfony/yaml: ^3.0
Requires (Dev)
- behat/behat: ^3.3
- monolog/monolog: ~1.3
- phpunit/phpunit: ^6.0
Suggests
- monolog/monolog: The recommended logging library to use with Propel.
This package is not auto-updated.
Last update: 2025-01-08 07:02:11 UTC
README
Propel3 is an open-source Object-Relational Mapping (ORM) for modern PHP 7.1+.
It is also written and maintained by people better and smarter than I am-- there wasn't an existing Propel3 on packagist. There is now...
So, this github repo and packagist entry exists solely for me to put into my PHP package.json, you are free to use it. But, know that once a valid propelorm/propel3 packagist package becomes available that I will begin using that and not maintaining this one.
Version 3 of Propel ORM replaces Propel2, which is not maintained anymore. Propel3 introduces a data-mapper implementation which separates your entities from the actual persisting logic.
Status
This is in current development and is not yet ready to use.
Features
- Propel is blazing fast
- Data mapper with runtime UnitOfWork for high performance with massive object counts (bulks inserts/updates)
- Query-Builder
- Very IDE friendly thanks to code-generation
- Generation of methods for all columns and relations
- Database schema migration
- Schema reverse engineering
- Customizable
- Propel comes with common ‘behaviors’
- Completely unit tested for MySQL, PostgreSQL, SQLite. Oracle and MSSQL are experimental.
Example
Define the entity
XML
<database name="default"> <entity name="Vendor\Car"> <field name="id" primaryKey="true" autoIncrement="true" type="INTEGER" /> <field name="name" type="VARCHAR" required="true" /> <relation target="Publisher" onDelete="setnull"/> <relation target="Author" onDelete="setnull" onUpdate="cascade"/> </entity> </database>
or annotations
In work.
namespace Vendor use Propel\Annotations\Entity; use Propel\Annotations\Field; use Propel\Annotations\PrimaryKey; /** * @Entity() */ class Car { /** * @PrimaryKey(auto_increment=true) */ private $id; /** * @Field(type="VARCHAR") */ private $name; // getters/setters }
Data mapper
$propel = new Propel\Runtime\Configuration('path/to/propel.yml'); // require a session for each request/workload $session = $propel->getSession(); $car = new Vendor\Car(); $car->setName('Ford'); $session->persist($car); $session->commit();
RAD/Active-record
// use <entity name="Vendor\Car" activeRecord="true"> $car = new Vendor\Car(); $car->setName('Ford'); $car->save();
Installation
Read the Propel documentation. This documentation is for Propel2 still.
Contribute
Everybody can contribute to Propel. Just fork it, and send Pull Requests. You have to follow PSR2 coding standards and provides unit tests as much as possible.
Please see our contribution guideline. Thank you!
License
See the LICENSE
file.