Download the PHP package coreorm/framework without Composer
On this page you can find all versions of the php package coreorm/framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package framework
CoreORM/Framework
What is this thing?
Writing data layer is boring, trying to remember all the table names and all the fields in the table is impossible, writing SQL queries is painful and it's so easy to make mistakes!
I'm sure we've all been through this and we probably trying to avoid this as much as we can, yeah I know there a loads of active-record type ORM layers out there for php to use, but really can you remember all the fields? really?!! And serious? I have to remember all the fields?
Nope, no, definitely not. So here I am introducing the simplified, light-weight and easy to use (well, code-autocompletion anyone?) ORM framework that totally does not suck.
features
- Thin models that can be used across different types of data source (MySQL/SQlite, will expand to cover more later)
- DAO (Data Access Objects) that manages the thin models instead of models carrying the connections.
- Out-of-the-box slave database support for large enterprise level data managements, supported by super simple APIs
- Table relations in database mapped as object relations!
- Zero SQL necessary! DAOs will automagically compose the SQL (and trust me, it's very fast) using the relations and criteria from the models.
- Zero code necessary for models! They are actually generated based on a very simple configuration file (more details see the sections below).
- Awesome performance - since the models are generated with all table/field information stored within the model, there's no need to describe table to generate queries or whatnot.
- Extensibility - all models are crafted following proper OOD patterns, it's super easy to extend any model to add functionalities (having said that, you really don't need to do this at 90% of the time).
- Less code, more accuracy (or actually it's 100% accuracy there). Since all tables are presented by models that contain proper getters and setters, you really don't need to remember the field name/table name at all, just type and your IDE should just give you a list of options to pick from.
- You really want to write your own queries still? That's fine too, add your own DAO extending the base DAO, and you are set!
compatibility
The current version of CoreORM supports the following 2 database systems
- MySQL
- SQLite Future versions will add PostgreSQL and MS SQL server, etc.
The current version also ships with out of the box Laravel & Slim framework compatibility.
For Laravel, since it contains db config already, simply add the following line in your , right before the final line , add the following line:
That's it!
For Slim framework, since database config is not part of the framework, you will have to add the database config in the following format before calling your Slim app:
Then right after that, ad the following line:
And you are set!
How to include this package in your project
Simple add the following into your composer.json
Install dependencies
NOTE: run composer install to enable autoload, if not all files are loading, run
composer dump-autoload
unit tests:
Please read the README.md file under directory.
setup the config this way (runtime).
*** NOTE: for Dynamodb, please follow Amazon's suggestion, have your credentials saved in
in the following format:
and ensure that your database setting follows the format:
generating models
Run the following commands at project root
to generate model, make sure you put a config.php file somewhere, see example below:
copy to your project root (same level as vendor directory) as it requires autoload.php from under the vendor/ directory (or, alternatively, if you would like to keep it somewhere else, just open it and ensure the autoload.php path is correct.
then just run
***NOTE Dynamodb Model Config should be in a slightly altered format, see below as an example (or check ):
Notice that in the example above, fields contains all fields you would like to put in there (due to the nature of dynamodb, these are NOT part of table, but you can push to add to it). And you need to specify the keys explicitly.
all the models will be generated in the directory you specified in the configuration file.
Summary of common APIs
-
Orm::writeModel(Model $model)
-
Orm::readModel(Model $model, $useSlave = false)
-
Orm::readModels(Model $model, $condition = array(), $bind = array(), $orderBy = array(), $limit = null, $useSlave = false)
- Orm::deleteModel(Model $model)
Examples:
For examples, visit the CoreORM\Examples
All versions of framework with dependencies
classpreloader/classpreloader Version ~1.0
aws/aws-sdk-php Version 2.6.*