1. Go to this page and download the library: Download kaisargaming/core-lib library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kaisargaming / core-lib example snippets
// Get a formatted time with a specific timezone
Utils::getTime('Y-m-d H:i:s', 'Asia/Hong_Kong');
php
class User extends Model
{
public function __construct()
{
// Construct the parent class with the table name
// and optionally the name of the primary key field
// the primary key is default to 'id'
parent::__construct('users', 'uid');
}
}
php
$users = new User();
// Find all users
$all_users = $users->find()->fetch();
// Find users with conditions
$male_users = $users->find()->where("`sex`='male' AND `age`>27")->fetch();
// Create a new user
// use ->update() for update
$users->set('name', 'John')
->set('age', 32)
->set('sex', 'male')
->save();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.