Download the PHP package doublemcz/dibi-orm without Composer

On this page you can find all versions of the php package doublemcz/dibi-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 dibi-orm

Dibi ORM - EXPERIMENTAL

Dibi ORM is lightweight ORM solution based on Dibi. ORM logic comes from Doctrine 2 but is very simplified. Focus is also on performance.

Installation

I recommend you to install via Composer.

If you do not have Composer, download latest version from GitHub and require bootstrap file.

Initialization

Usage in Nette

Put this section into services.neon

It is also possible to pass DibiConnection to parameter 'database'

Data handling

Get an Entity by ID

Find a user with ID = 1

If user has more columns in primary key, you can pass it in order you defined the key at the entity

Find an Entity by propety

We can find an Entity by property e-mail

Get entities in table

Find all users in table 'users'

You can filter and sort by array. We are trying to find Users in role 'admin' ordered by id desc.

Insert entity to database
Update entity

When you load an entity from repository then the entity is automatically managed by Manager. It means that if you make a change and flush changes over Manager a SQL query is automatically executed.

Delete entity
Database Manager knows what have changed

You can flush whenever you want. Manager knows what data have changed and does necessary stuff on flush.

Entity Settings

All settings are defined by PhpDoc. Every entity must have @table tag to specify the source table defined on class PhpDoc. Every class property that has relation to database column must have tag @column.

Defining primary column

Every entity must have primary key. The definition is composed by @primaryKey and @column. If you want set id that was generated from database on create sql query then specify @autoIncrement tag.

Relations

Basic relation are defined by @oneToOne and @oneToMany tag. Both need a join specification tag defined as follow: @join(column="id", referenceColumn="userId"). It says that it is joing column User.id to RelatedTable.userId column.

Real example:
Static join parameter

It is also possible to specify static join parameter to filter table by column. Here you can see static join that defines user.type = 'error'. Static join is possible only on @oneToOne and @oneToMany relations.

Relation @manyToMany

Relation many-to-many is used when your data are connected over relation table.

Events

Manager has event handling based on methods included in the Class. We have Entity events at this moment:

Examples of event usage.

There you can see how we can update an entity before create or update sql is executed.

Example of User entity definition


All versions of dibi-orm with dependencies

PHP Build Version
Package Version
No informations.
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 doublemcz/dibi-orm contains the following files

Loading the files please wait ....