Getting Started

Quickstart

Get a Glueful API running in a few minutes

This quickstart uses glueful/api-skeleton, which is the recommended way to start.

Create the Project

composer create-project glueful/api-skeleton my-api
cd my-api
composer install
php glueful install --quiet
php glueful serve

Your API should now be running at http://127.0.0.1:8080.

Verify the Starter Endpoints

The skeleton ships with a couple of routes out of the box:

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

Next Steps