The Paradigm
Intro
FoxORM is an ORM structuring database on the fly.
You work with PHP objects and it will create tables and columns and modify them automagically to
fitting yours data.
FoxORM is inspired by the famous and awesome RedBean.
Like RedBean, FoxORM use a convention over configuration approach but in FoxORM you can override convention with your own configuration for primary keys by table to work on other projects that allready have a database.
If you let config by default the convention used is the same than RedBean's one, that means you can work on RedBean's defined DB with total compatibility.
Supported Databases
FoxORM natively support the open-source most populars RDBMS
MySQL/MariaDB,
PostgreSQL,
SQLite
and CUBRID.
Following DataMapper Pattern, it allowing you to build plugins also for non relational database
like NoSQL
Cassandra,
MongoDB
or XML, JSON and even File System.
Design Pattern
Unlike to other ORM, FoxORM is based on DataMapper pattern for a better SoC but an ActiveRecord overlay was added for improve Rapid Application Development. So you can choose to use it in a decoupled model datamapper way, or you can choose to extend your model from FoxORM's preset model class.
Dynamic Database
FoxORM adapt dynamically database to your application's needs.
It create tables when needed and add or evolve columns according to
the values you give it to store.
For instance, a short text might be stored as a VARCHAR
while a large text might be stored as TEXT.
Some column types behave differently, for instance if you store a valid
ISO formatted date (eg 2015-01-01)
FoxORM builds a DATE column, but this column, as a special type,
will not change anymore.
You can freeze the database when your developement is done
and the database schema will no longer change.
FoxORM will never "shrink" columns (from TEXT to VARCHAR)
to avoid data loss.
FoxORM also only manipulates column types it recognizes, so if you change
a VARCHAR(255) to a VARCHAR(254)
it will leave that column alone, since it no longer recognizes the type.
This means that if you customize columns, FoxORM will leaves them as they are.
If FoxORM alters the database in a way you don't like, don't worry, you can always tune
the schema to your liking, just using a database management tool like
adminer
or phpmyadmin.
This approach is exactly the same than RedBean's one.