1. Go to this page and download the library: Download tobento/app-backend 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/ */
tobento / app-backend example snippets
use Tobento\App\AppFactory;
// Create the app
$app = (new AppFactory())->createApp();
// Add directories:
$app->dirs()
->dir(realpath(__DIR__.'/../'), 'root')
->dir(realpath(__DIR__.'/../app/'), 'app')
->dir($app->dir('app').'config', 'config', group: 'config')
->dir($app->dir('root').'public', 'public')
->dir($app->dir('root').'vendor', 'vendor');
// Adding boots
$app->boot(\Tobento\App\Backend\Boot\Backend::class);
// Run the app
$app->run();
'boots' => [
// ...
SomeBoot::class,
],
use Tobento\App\Boot;
use Tobento\App\Backend\Boot\Backend;
class BackendBoots extends Boot
{
public const BOOT = [
Backend::class,
];
public function boot(Backend $backend): void
{
$backend->addBoot(SomeBoot::class);
}
}
use Tobento\App\AppFactory;
// Create the app
$app = (new AppFactory())->createApp();
// Add directories:
$app->dirs()
->dir(realpath(__DIR__.'/../'), 'root')
->dir(realpath(__DIR__.'/../app/'), 'app')
->dir($app->dir('app').'config', 'config', group: 'config')
->dir($app->dir('root').'public', 'public')
->dir($app->dir('root').'vendor', 'vendor');
// Adding boots
$app->boot(\Tobento\App\Backend\Boot\Backend::class);
$app->boot(BackendBoots::class);
// Run the app
$app->run();
use Tobento\App\Backend\Card\DashboardCards;
use Tobento\App\Card\Factory;
$app->on(
DashboardCards::class,
static function(DashboardCards $cards): void {
// Adding cards:
$cards->add(name: 'foo', card: new Factory\Table(
rows: ['foo', 'bar'],
));
}
);
namespace App;
use use Tobento\App\Backend\Controller\RoleCrudController;
class Customization extends Boot
{
public function boot(): void
{
// Custom controller:
$this->app->set(RoleCrudController::class, \App\CustomRoleCrudController::class);
}
}
use Tobento\App\AppInterface;
final class SomeBackendAppTest extends \Tobento\App\Testing\TestCase
{
use \Tobento\App\Testing\Database\MigrateDatabases;
public function createApp(): AppInterface
{
$app = $this->createTmpApp(rootDir: __DIR__.'/../..');
$app->boot(\Tobento\App\Backend\Boot\Backend::class);
$app->booting();
$app = $app->get(AppsInterface::class)->get('backend')->app();
$app->boot(\Tobento\App\Seeding\Boot\Seeding::class);
$app->boot(\Tobento\App\Backend\Testing\UserAndRolesBoot::class);
return $app;
}
}
app/config/apps.php
apps/backend/config/app.php
apps/backend/config/app.php
apps/backend/config/app.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.