PHP code example of sofyphp / framework

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

    

sofyphp / framework example snippets


return UI::page('Dashboard')
    ->add(
        UI::grid(3, [
            UI::stat('Revenue', '$42k')->color('#10b981'),
            UI::stat('Users',    1240, '+5%'),
            UI::stat('Active',    983, '+2%'),
        ]),
        UI::card('Welcome', UI::alert('No templates. No build step. Just PHP.', 'info')),
    )
    ->response();

// routes/web.php
$router->get('/hello/{name}', fn(Request $r, string $name): Response =>
    UI::page("Hello, $name!")
        ->add(UI::hero("Hello, $name!", 'Welcome to Sofy.')
            ->action(UI::button('Get started', '/docs', 'primary')))
        ->response()
);
bash
composer create-project sofyphp/framework my-app   # or: git clone … && composer install
cd my-app
cp .env.example .env
php sofy key:generate
php sofy migrate
php sofy admin:create        # interactive admin user
php -S localhost:8000 -t public
bash
sudo php sofy full-install        # interactive: domain, PHP, web server, SSL, DB, services
bash
php sofy optimize     # route + config cache + opcache preload
php sofy ui:build      # extract CSS/JS into cached static assets