1. Go to this page and download the library: Download luismoralesp/primal 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/ */
luismoralesp / primal example snippets
class Myapp extends JsonView {
/**
* This is an autogenerated code for started project
**/
public function index(){
return '{"message": "Congratulation this is your first service using primal"}';
}
}
/**
* Import kernel framework and routing
*/
Set a default routing
*/
$router = Router::getInstance('myapp.myapp.index');
/**
* Configure routing
*/
$router->setUrls([
'hi' => 'myapp.myapp.index'
]);
/**
* Show routed service
*/
echo $router->rout(realpath(dirname(__FILE__)));
Kernel::package('app');
class MyModel extends Model{
private $id;
private $first_name;
private $last_name;
private $tel;
public function __construct(){
$this->id = Constrain::pk($this);
$this->first_name = Input::create_text('first_name');
$this->last_name = Input::create_text('last_name');
$this->tel = Input::create_integer('tel');
}
/* So your getters and setters */
Kernel::import('app.MyModel ');
class Myapp extends JsonView {
/**
* This is an autogenerated code for started project
**/
public function index(){
return MyModel::persistence()->filter();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.