, (*1)
Phiber - ALPHA version 1.2
, (*2)
Phiber is a simple ORM framework that helps you code your applications faster., (*3)
- MySQL integration
- Object Orientation
- Without SQL
New Features!
- Persistence
- Build websites, apps and api without a single SQL query line.
- Choose if you wanna make your SQL manually or by Object Mapping.
You can also:
- See generated SQL
- Activate console logs., (*4)
This library has been made by a Internet Systems Tecnology's student from Morrinhos - GO, Brazil., (*5)
, (*6)
Creator [Márcio Lucas], (*7)
I made this library to increase my knowledge and to help my programmer friends build apps in PHP faster, because I see big difficulty to build SQLs and i think it is very boring., (*8)
This library are in alpha test, I don't recommend to production environments., (*9)
Technology
Phiber uses just pure PHP and until now only has been builded the part to MySQL 5.5+.
*In the next versions we will implement in BDs like PostgreSQL and Oracle., (*10)
Dependencies
Phiber have only depdencies with Composer., (*11)
Installation
Phiber requires PHP 5.3.3+ to run and MySQL 5.5+., (*12)
Installing Phiber in your project., (*13)
The Phiber instalation is made by Composer, using the console code below:, (*14)
$ composer require marciioluucas/phiber
Config
To configure Phiber is very simple,
you have to create an archive called phiber_config.json in your project root path
same like this., (*15)
$ROOT_PROJECT_PATH/phiber_config.json, (*16)
{
"phiber": {
"language": "pt_br",
"link": {
"database_technology": "mysql",
"database_name": "phiber_test",
"url": "mysql:host=localhost;dbname=teste_phiber",
"user": "root",
"password": "",
"connection_cache": true
},
"log": true,
"execute_queries": true
}
}
Examples
InnerJoin example:
$phiber = new Phiber();
$phiber->setTable("user");
$phiber->setFields(["user.id","user.name","user.email"]);
$phiber->add($phiber->restrictions->join("user_address", ["pk_user", "fk_user"]));
$phiber->add($phiber->restrictions->and($phiber->restrictions->equals("user.id","1"), $phiber->restrictions->like("user.name","Marcio") ));
$phiber->add($phiber->restrictions->limit(15));
$phiber->add($phiber->restrictions->offset(5));
$phiber->add($phiber->restrictions->orderBy(['user.id ASC']));
$phiber->select(); // Execute query
echo $phiber->show(); // After execute, prints the generated query
Generate->
SELECT user.id, user.name, user.email FROM user INNER JOIN user_address ON pk_user = fk_user WHERE (user.id = :condition_user.id AND user.name LIKE CONCAT('%',:condition_user.name,'%')) ORDER BY user.id ASC LIMIT 15 OFFSET 5;
TODOS:
- In the create method, make the support for the composition and others.
- Split classes correctly
- Do Relationables tables
License
MIT, (*17)
Free Software, Hell Yeah!, (*18)