Download the PHP package byjg/micro-orm without Composer

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

MicroOrm for PHP

Build Status Opensource ByJG GitHub source GitHub license GitHub release

A micro framework for create a very simple decoupled ORM. This library intended to be very small and very simple to use;

Key Features:

Architecture

These are the key components:

Examples

For the examples below we will use the class 'Users';

First of all will create a Table Mapping class:

Then you need to create the dataset object and the repository:

Some examples with the repository:

Update Constraints

You can define a constraint to update a record. If the constraint is not satisfied the update will not be performed.

Advanced uses

Get a collection using the query object:

Returning multiples entities with a query:

Using FieldAlias

Field alias is an alternate name for a field. This is usefull for disambiguation on join and leftjoin queries. Imagine in the example above if both tables ITEM and ORDER have the same field called 'ID'.

In that scenario, the value of ID will be overriden. The solution is use the FieldAlias like below:

You can also add a MAPPER as a Field. In that case the MAPPER will create the field and the correct aliases.

Tables without auto increments fields

Applying functions for Select and Update

Observers

You can add observers to the repository. The observer will be called after the insert, update or delete a record in the DB.

The ObserverData class contains the following properties:

Note: The observer will not be called if the insert, update or delete is called using the DBDriver object.

Using With Recursive SQL Command

Pre-defined closures for field map

Mapper::defaultClosure($value, $instance)

Defines the basic behavior for select and update fields;

Mapper::doNotUpdateClosure($value, $instance)

If set in the update field map will make the field not updatable by the micro-orm. It is usefull for fields that are pre-defined like 'Primary Key'; timestamp fields based on the update and the creation; and others

Before insert and update functions

You can also set closure to be applied before insert or update a record. In this case will set in the Repository:

TransactionManager object

It allows you to create a single database transaction with multiple repositories. If any of the repositories fails the transaction will be rolled back for all repositories. When you commit the transaction all repositories will be commited.

Install

Just type:

Running Tests

Related Projects

Dependencies


Open source ByJG


All versions of micro-orm with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
byjg/anydataset-db Version 4.9.*
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 byjg/micro-orm contains the following files

Loading the files please wait ....