Getting Started

Installation

Install Glueful with the API skeleton (or as a framework package), run the dev server, and add your first route.

Glueful has two entry points:

  1. glueful/api-skeleton for most users. This is the recommended path.
  2. glueful/framework if you are embedding the framework into an existing project.

Requirements

  • PHP 8.3+
  • Composer 2+

Create a new project from the starter app:

composer create-project glueful/api-skeleton my-api
cd my-api

The skeleton already includes:

  • a CLI entrypoint at glueful
  • framework bootstrap in bootstrap/app.php
  • example routes in routes/api.php
  • example controller in app/Controllers/WelcomeController.php
  • default SQLite storage in storage/database/glueful.sqlite

Run it

composer create-project already installs dependencies, copies .env, creates the SQLite database, and runs php glueful install for you — so the app is ready. Start the dev server:

php glueful serve

Then verify the starter routes:

curl http://127.0.0.1:8080/welcome
curl http://127.0.0.1:8080/v1/status
curl http://127.0.0.1:8080/health

Add your first route

Open routes/api.php and add a route inside the existing v1 group:

<?php

use Glueful\Routing\Router;
use Glueful\Http\Response;
use App\Controllers\WelcomeController;

$router->group(['prefix' => 'v1'], function (Router $router) {
    $router->get('/status', [WelcomeController::class, 'status']);

    $router->get('/hello', function () {
        return Response::success([
            'message' => 'Hello from Glueful',
            'timestamp' => date('c'),
        ]);
    });
});

$router->get('/welcome', [WelcomeController::class, 'index']);

Test it:

curl http://127.0.0.1:8080/v1/hello

Generate new code

Glueful's current generators use the scaffold:* namespace:

php glueful scaffold:controller UserController
php glueful scaffold:model User
php glueful scaffold:request CreateUserRequest

Alternative: Framework Only

Install the framework package into an existing PHP project:

composer require glueful/framework

Create a minimal bootstrap:

<?php
declare(strict_types=1);

use Glueful\Framework;
use Symfony\Component\HttpFoundation\Request;

require __DIR__ . '/vendor/autoload.php';

$framework = Framework::create(__DIR__)
    ->withConfigDir(__DIR__ . '/config')
    ->withEnvironment($_ENV['APP_ENV'] ?? 'development');

$app = $framework->boot();

$request = Request::createFromGlobals();
$response = $app->handle($request);
$response->send();
$app->terminate($request, $response);

Use this path only if you already know the project structure you want. If not, use the API skeleton.

Next Steps