Download the PHP package hidejec/liquido-orm without Composer
On this page you can find all versions of the php package hidejec/liquido-orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hidejec/liquido-orm
More information about hidejec/liquido-orm
Files in hidejec/liquido-orm
Package liquido-orm
Short Description LiquidoORM Framework Developed by Team Liquido(Inspired by Laravel Eloquent ORM)
License
Homepage https://github.com/Hidejec/Liquido
Informations about the package liquido-orm
LiquidoORM
LiquidoORM is a simple object relational mapping which helps you query database easily with just a minimum amount of code.
How to Install
then autoload in your project
Configuration
Create a configuration file for your database and name it dbconfig.liquido.php
And save it inside your project root directory.
Intialize the LiquidoORM in your index.php
Usage
Create a model and extend the LiquidoORM. For example a Customer Model
The Model automatically set the table with the plural name of the Model so you don't have to write again and again the table you want to run the query.
In our example, The table is set to
customers
. So be sure that you have a table namedcustomers
inside your database. Another example: if you have a model class nameProduct
, the table will be set toproducts
automatically. Another example: Class NameIllness
=illnesses
.
If you want to specify custom table name, just add this inside your model:
Note that it should be
Get all result and store it in a variable
Simple right ? :) It returns an array of results which you can manipulate inside a loop.
Example if you are using a twig view
Get a single result passing a primary key ID
Get result with predefined conditions
Example I will fetch all data with the first name "Jacob". To do this...
Fetching with multiple conditions
This will going to select all rows with a Status "Single" AND First_Name "Jacob".
condition-type can be a
- AND
- &&
- OR
- ||
How about an OR inside a condition-type AND.
Example _Select all rows with a Status "Single" AND First_Name "Jacob" AND (LastName "Ramos" OR "Reyes") To do this...
The 'Last_Name' => ['Ramos', 'Reyes']
Automatically pertains to the conditional statement "OR". So in normal query it will be WHERE Last_Name = 'Ramos' OR Last_Name = 'Reyes';
I prefer the above method if your going the search for a data with a specified string. But what if your going to fetch the data with the id's less than 10.
Get data for numerical conditions
Note that you can also use this similar to the above ::with() but I prefer to use the liquid method ::where() if you have a condition related to numbers since it's much easy to use.
How to Add/Insert a data
You can pass any amount of columns depending on your needs.
Tip
Optionally you can specify a column name to the queries.
The default was set to all. SELECT * FROM table;
To query to a specific column example the liquid method ::withId()
Note that this is applicable to all LIQUID METHODS just add another argument prior to the required arguments of the liquid methods.
NOTE THAT THIS IS A PRE_RELEASED!
Further improvements and functionalities will be released in the future builds. Thank you :)
Cheers,
Hidejec - Developer of Team Liquido