The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

Kit: An Opinionated API Starter Kit for Laravel

Last updated on by

Kit: An Opinionated API Starter Kit for Laravel image

Kit by Steve McDougall is a Laravel API starter kit built around token-based authentication, API documentation, and security-first defaults. It targets developers who want a structured starting point for building versioned JSON APIs without wiring everything up from scratch.

Getting Started

Clone the repository, install dependencies, and run the setup script:

composer install
composer run setup
php artisan serve

The composer run setup command copies .env.example to .env, generates an app key, and runs migrations against a local SQLite database.

API Architecture

Kit takes a few deliberate architectural positions:

  • No global /api prefix — routes are versioned directly, e.g. /v1/auth/login
  • Invokable controllers only — each controller is a single __invoke method
  • Form Requests for validation — request payloads are validated in dedicated FormRequest classes, with DTO-style payload classes in app/Http/Payloads/V1
  • JSON:API resource format — responses follow a consistent structure for entity data

Authentication

Nine routes handle the full auth lifecycle:

  • Registration and login (both return tokens via Laravel Sanctum)
  • /v1/auth/me (requires Bearer token)
  • Email verification via signed URLs
  • Password reset with anti-enumeration responses (the same response is returned whether or not the email exists)

Security Defaults

Kit includes several security defaults out of the box:

  • ULID primary keys for user records
  • Predefined rate limits on auth endpoints, configurable in AppServiceProvider
  • Mandatory Content-Type: application/json enforcement on write requests
  • Hardened response headers, including X-Content-Type-Options: nosniff, X-Frame-Options: DENY, and Referrer-Policy: no-referrer
  • Request ID tracking
  • Audit logging for sensitive operations
  • and more

Sunset Middleware

Kit also includes a Sunset middleware for deprecating API endpoints over time. You apply it directly to a route with three parameters: the sunset date, a successor URL, and a boolean to control enforcement:

Route::middleware('sunset:2027-01-01,https://api.acme.com/v2/auth/login,true')
->post('/v1/auth/login', LoginController::class);

While the endpoint is still active, the middleware appends Deprecation, Sunset, and Link (successor-version) headers to every response, so API clients can detect the deprecation and plan accordingly. Once the sunset date passes and enforcement is enabled, the endpoint returns 410 Gone.

Documentation

API documentation is generated using Scribe. Annotations are attribute-based rather than docblock-based, and the setup produces an OpenAPI spec alongside the docs.

Localization

Kit respects the Accept-Language request header and responds with a Content-Language header. Supported locales default to en and es, with translation files at lang/en/api.php and lang/es/api.php.

Tooling

The project uses Pest for tests, PHPStan for static analysis, Pint for code formatting, and Rector for automated refactoring. GitHub Actions workflows run CI tests on every push, apply daily dependency updates, and run security scanning with composer audit and Gitleaks.

Requirements

  • PHP 8.5+
  • Laravel 12
  • SQLite (for local development; configurable for other databases)

Visit juststeveking/kit on GitHub to browse the source code and learn more.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Jump24 - UK Laravel Agency

Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Visit Jump24 - UK Laravel Agency
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Spatie Shares Their Coding Guidelines as AI Skills image

Spatie Shares Their Coding Guidelines as AI Skills

Read article
AI Generative Engine Optimization for Laravel image

AI Generative Engine Optimization for Laravel

Read article
Attach PDFs Directly to Mailables in laravel-pdf 2.6.0 image

Attach PDFs Directly to Mailables in laravel-pdf 2.6.0

Read article
Composer 2.9.6 Fixes Two Perforce Command Injection Vulnerabilities image

Composer 2.9.6 Fixes Two Perforce Command Injection Vulnerabilities

Read article
Ship AI with Laravel: Your AI Agent Has Amnesia. Let's Fix It. image

Ship AI with Laravel: Your AI Agent Has Amnesia. Let's Fix It.

Read article
Redis Cluster Support for Queues in Laravel 13.5.0 image

Redis Cluster Support for Queues in Laravel 13.5.0

Read article