1. Go to this page and download the library: Download gp/sys 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/ */
gp / sys example snippets
// src/DataModel/App.php
namespace App\DataModel;
use System\Core\Data\DataRecord;
class App extends DataRecord
{
public $id;
public $name;
public $version;
public $description;
public $author;
public $created_at;
public $updated_at;
public function table(): string { return 'app'; }
public function primaryKey(): string { return 'id'; }
}
// src/Module/App/Controller/AppController.php
namespace App\Module\App\Controller;
use App\Module\App\View\AppView;
use System\Core\Base\Controller\Controller;
class AppController extends Controller
{
public function indexPage()
{
$view = new AppView();
$view->addContents($view->getHomePage());
return $view->get();
}
}
public class AppController {
public function action() {
$service = $this->load->service->app; // AppService object.
$model = $this->load->model->app; // App object.
$library = $this->load->library->cache; // Cache library object.
// to load not registered class
$this->loader->service(AppService::class);// service
$this->loader->model(AppModel::class);// model
$this->loader->library(Library::class); // library
$this->loader->helper('helper_file.php'); // helper
}
}