Download the PHP package 4k1r0/ormega without Composer

On this page you can find all versions of the php package 4k1r0/ormega. 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 ormega

Ormega

Basic ORM for MySQL with classes generator directly from database

! Non CodeIgniter projects !

This ORM use Codeigniter Querybuilder so there's a standalone CI Querybuilder integreted with.

For codeigniter projects see here.

Install with composer

composer require 4k1r0/ormega

Model Generation

How to

Generated classes

This will create a dir {namespace} in ./{path}

If I run the generator from /var/www/myproject/ whith

Will result in :

'Enum' is explained below.

'Entity' and 'Query' dir contains one empty php class for each table parsed with the generator and a 'base' directory.

These classes inherits from the one inside the base directory. They're empty to allow custom methods override.

They will not being erased if you restart the generation.

The "true" classes are in 'base' directories.

They must no be manually modified because a new file is wrote at each generation.

Custom methods

In these "empty" classes you're free to redefine every method.

You can add whatever you want in setters, getters, or even save method.

Or create customs queries (override find()) or filters.

Enum

Enums are specials models created from tables named 'enum[...]' and are designed to contains CONSTANTS.

These tables must have only 3 columns : 'id', 'label', 'constant'

If you want to add a constant, you will have to restart the generation.

Example :

Table enumgender

id label constant
1 man gender id MAN
2 woman gender id WOMAN

Can be used like this

This allow a more readable code than hardcode the man ID.

The 'label' column is used as a description.

The code generated will look like this

There's also a set of methods within :

Usage

Init

This will add an autoloader for generated models.

Manipulate, insert or update

There's a setter and a getter for every table's columns.

Setters have an automatic data check based on column's type and length.

Ex : a mysql tinyint(1) will be converted to php boolean

This check throw a InvalidArgumentException.

Select multiple

::create() is a shortcut for $oUserQuery = new \Ormega\Query\User();

Select one

Results

Usage : Foreign keys

The generator detects foreign keys and add an attribute for each in generated models.

So you can directly set the referenced Ormega entity model instead of foreign ID.

User Profil
id id
login #fk_user_id

_FK1 userid reference User.id

Tips : If you modify both User and Profil entity, only one save is necessary on Profil entity.

Model generated :


All versions of ormega with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
composer/installers Version 1.0.*
4k1r0/codeigniterdb Version 1.0.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 4k1r0/ormega contains the following files

Loading the files please wait ....