Download the PHP package danog/async-orm without Composer

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

Async ORM

codecov Psalm coverage Psalm level 1 License

Async PHP ORM based on AMPHP v3 and fibers, created by Daniil Gentili (https://daniil.it) and Alexander Pankratov (https://github.com/xtrime-ru).

Supports MySQL, Redis, Postgres.

Features read and write-back caching, type-specific optimizations, and much more!

This ORM library was initially created for MadelineProto, an async PHP client API for the telegram MTProto protocol.

Installation

Usage

There are two main ways to use the ORM: through automatic ORM properties, which automatically connects appropriately marked DbArray properties to the specified database, or by manually instantiating a DbArray with a DbArrayBuilder.

The DbArray obtained through one of the methods below is an abstract array object that automatically stores and fetches elements of the specified type », from the specified database.

DbArrays of type ValueType::OBJECT can contain objects extending DbObject.

Classes extending DbObject have a special save method that can be used to persist object changes to the database, as can be seen in the example.

Automatic ORM properties example

Manual ORM properties example

See here »

Settings

As specified in the examples above, there are multiple settings classes that can be used to connect to a specific database type:

All these classes have multiple fields, described in their respective documentation (click on each class name to view it).

Caching

One of the most important settings is the cacheTtl field, which specifies the duration of the read and write cache.

If non-zero, all array elements fetched from the database will be stored in an in-memory read cache for the specified number of seconds; multiple accesses to the same field will each postpone flushing of that field by cacheTtl seconds.

All elements written to the array by the application will also be stored in an in-memory write cache, and flushed to the database every cacheTtl seconds.

The cache is also flushed on shutdown by deferring an event loop callback, so make sure EventLoop::run(); is being used to run the application, to make sure all data is flushed correctly (alternatively, saveDbProperties can be used to manually flush the cache on shutdown when using automatic properties, and flushCache in manual mode).

If the array has an object value type (ValueType::OBJECT), write caching is disabled.

If cacheTtl is 0, read and write caching is disabled.

A special setting class is used to create DbArrays backed by no database, which can also be useful in certain circumstances:

Key and value types

Each DbArray must have a specific key and value type.

For optimal performance, the specified types must be as strict as possible, here's a list of allowed types:

Key types

Value types

One of the most important value types is ValueType::OBJECT, it is used to store entire objects extending the DbObject class to the database.

Objects extending DbObject have a special save method that can be used to persist object changes to the database, as can be seen in the example.

API Documentation

Click here » to view the API documentation.


All versions of async-orm with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.4
amphp/mysql Version ^3.0
amphp/postgres Version ^2.0
amphp/redis Version ^2.0
amphp/sync Version ^2.2
revolt/event-loop Version ^1.0.6
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 danog/async-orm contains the following files

Loading the files please wait ....