Download the PHP package initorm/orm without Composer

On this page you can find all versions of the php package initorm/orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package orm

InitORM ORM

A lightweight, PDO-based ORM. Each subclass of initorm/database. Entities support per-column accessor and mutator hooks (Laravel-style), and models ship with optional timestamp columns, soft deletes, and per-operation permission gates.

Latest Stable Version Total Downloads License PHP Version Require PHPUnit PHPStan PHP_CodeSniffer


Requirements

Supported databases

The full query-builder dialect support comes through initorm/database: MySQL/MariaDB, PostgreSQL, and SQLite ship with dialect-aware identifier quoting; any other PDO driver works through a no-escape generic driver.

Installation

initorm/orm pulls in initorm/database, initorm/dbal, and initorm/query-builder transitively — you do not need to require them yourself.


Quick start

Define a model:

Define an entity:

Use the model:


How it fits together

A Model holds a DatabaseInterface and forwards unknown calls to it via __call. The Database, in turn, forwards builder calls (where, select, orderBy, …) to the underlying query builder. Chainable calls re-wrap at every boundary, so this all stays fluent on the Model:

The full query-builder surface (~100 methods including joins, group/having, sub-queries, LIKE family, BETWEEN, IN, raw expressions) is documented in initorm/query-builder and initorm/database.


Configuration reference

These protected properties shape a model's behaviour. All are optional with sensible defaults.

Property Type Default Notes
$schema string (derived) Table name. When unset, auto-derived from the short class name via snake_case conversion.
$schemaId string 'id' Primary-key column. Lifted out of update()'s $set into a WHERE; used by save() to pick CRUD.
$entity class-string Entity::class Class used to hydrate read() rows.
$credentials array\|null null Standalone connection credentials; null binds to the shared DB facade.
$writable bool true When false, create()/createBatch() throw WritableException.
$readable bool true When false, read() throws ReadableException.
$updatable bool true When false, update()/updateBatch() throw UpdatableException.
$deletable bool true When false, delete() throws DeletableException.
$createdField string\|null null Auto-filled with the current timestamp on every create. Disabled when null.
$updatedField string\|null null Auto-filled with the current timestamp on every update. Disabled when null.
$useSoftDeletes bool false When true, delete() sets $deletedField instead of issuing a DELETE. Requires $deletedField.
$deletedField string\|null null Soft-delete marker column. Must be set when $useSoftDeletes is true (enforced at construction).
$timestampFormat string 'Y-m-d H:i:s' date() format used for created / updated / deleted columns.

Soft deletes

When $useSoftDeletes = true:

update() and updateBatch() automatically add $deletedField IS NULL to avoid resurrecting soft-deleted rows.


Entities, accessors, and mutators

Entity stores values in an internal attribute bag ($attributes) and exposes them through the magic __get / __set accessors. For column post_title, you can define:


Permission gates

Each operation is gated by a flag — flip any to false and the matching typed exception fires:

All four — WritableException, ReadableException, UpdatableException, DeletableException — extend ModelException, so a single catch handles all of them.


Multiple connections

Models bind to the shared DB facade by default. Set $credentials on a subclass to give it its own connection:

$credentials is passed through to InitORM\Database\Facade\DB::connect(), which builds a fresh Database (and underlying connection) without touching the shared facade slot.


Testing

The library ships with a comprehensive PHPUnit 10 suite that exercises the model against an in-memory SQLite database. Patterns for testing your own models live in tests/Support/AbstractModelTestCase.php.

Run the full quality suite locally:

Individual targets:


Documentation

Deeper, code-first guides live under docs/:


Contributing

Contributions are welcome. The general flow is:

  1. Fork and branch off master.
  2. Add tests for the behaviour you change (see tests/ — SQLite in-memory, fast, dependency-free).
  3. Run the full quality suite locally:

  4. Open a PR — CI runs the same suite across PHP 8.1–8.4.

By submitting a contribution you agree to license it under the MIT License.

Credits

License

Released under the MIT License.


All versions of orm with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-pdo Version *
initorm/database Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package initorm/orm contains the following files

Loading the files please wait ...