Classes, interfaces and traits

IDatabase

Database interface

To add support for new database, the new class has to implement this interface. Check MYSQLDatabase.php for example

« More »

Database

Database class

This class process the Query/Update/Delete/Insert class to string and execute it

« More »

Delete

Delete class

This class holds all the information regarding DELETE operation, that will be used by Database class.

Example

$deleteOperation = new Delete('User');
$deleteOperation->where('id', '=', '1');
$deleteOperation->exec();
« More »

File

File class

This class hold information about a file.

Example

$file = new File('docs', 'cv.pdf', 'base64 content');
« More »

FileStorage

FileStorage class

This class holds utils to save and delete file.

Example

$file = new File('docs', 'cv.pdf', 'base64 content');
FileStorage::saveFile($file);
FileStorage::deleteFile($file);
FileStorage::deleteFolder('./folder_to_be_deleted');
« More »

Insert

Insert class

This class holds all the information regarding INSERT operation, that will be used by Database class.

Example

$data = [
 "name": "John Doe"
];
$insertOperation = new Insert('User', $data);
$insertOperation->exec();
« More »

Model

Model class

This class is the main Model class

Example

class User extends Model {
 protected $table = 'user';
 protected $primaryKey = 'id';
 protected $fillable = ["fullName", "email"];
}
$user = new User();
$user->fullName = "John Doe";
$user->email = "johndoe@example.com";
$user->save();
$foundUser = User::find($user->getPrimaryValue());
$user2 = User::where("fullName", "John Doe")->limit(1)->orderBy('id')->exec();
« More »

MYSQLDatabase

MYSQLDatabase class

This class holds the logics to convert Query/Update/Insert/Delete class to actual MYSQL query string This class will be extended my Database class

« More »

Query

Query class

This class holds all the information regarding SELECT operation, that will be used by Database class.

« More »

Update

Update class

This class holds all the information regarding UPDATE operation, that will be used by Database class.

« More »

Validator

Validator class

This class holds utils to validate data.

Example

$data = [
 "name" => "John Doe"
];

$config = [
 "name" => [
   "require" => true
 ]
];
$validator = new Validator($data, $config);
echo $validator->isValid(); // Returns 'true'
« More »