PHP code example of vetalforge / jumpix-app

1. Go to this page and download the library: Download vetalforge/jumpix-app 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/ */

    

vetalforge / jumpix-app example snippets


define('HOST', env_value('HOST', 'http://localhost'));
define('DOMAIN_ADDITION', env_value('DOMAIN_ADDITION', '/jumpix-app'));
define('DB_HOST', env_value('DB_HOST', 'localhost'));
define('DB_USER', env_value('DB_USER', 'root'));
define('DB_PASS', env_value('DB_PASS', ''));
define('DB_NAME', env_value('DB_NAME', 'framework_test'));
define('ORM_DRIVER', env_value('ORM_DRIVER', 'native'));

use App\Controllers\MainPageController;
use App\Controllers\DemoController;

return [
    '/' => [
        'controller' => MainPageController::class,
        'action' => 'index',
    ],
    '/usage' => [
        'controller' => DemoController::class,
        'action' => 'index',
    ],
];

namespace App\Controllers;

use Jumpix\Http\Request;
use Jumpix\Http\Session;

class MainPageController extends Controller
{
    public function __construct(Request $request, Session $session)
    {
        parent::__construct($request, $session);
    }

    public function index(): void
    {
        $this->render('main_page');
    }
}

namespace App\Models;

use Jumpix\Models\Model;

class User extends Model
{
    protected string $table = 'users';
}

use App\Models\User;

$users = User::all();
$user = User::find(1);

$user = User::create([
    'name' => 'John Doe',
    'email' => '[email protected]',
]);

$user->name = 'John Updated';
$user->save();
$user->delete();

$this->render('header', ['home' => HOST . DOMAIN_ADDITION]);
$this->render('main_page');
$this->render('footer');
text
app/
  Controllers/   Application controllers
  Entities/      Doctrine entities
  Models/        Native Active Record models
config/
  app.php        Application constants and environment values
  dependencies.php
  routes.php
database/        SQL files and seeder script
public/          Web root
resources/       Views and frontend assets
bash
php database/seeder.php