Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-api-starter

> 后端框架
Open source

⭐️ Build APIs You Won't Hate In Laravel.

100 stars0 likes0 views
WebsiteGitHub

About

⭐️ Build APIs You Won't Hate In Laravel.

Introduction

Laravel API Starter streamlines modern API development in Laravel. This carefully crafted starter project is designed to simplify and expedite your journey in building APIs with Laravel. Serving as a launchpad for your next project, it equips you with a comprehensive set of ready-to-use tools commonly required in API development. Save time and kickstart your Laravel API project effortlessly with Laravel API Starter.

Laravel API Starter comes included with...

  • Laravel Passport for OAuth Authentication, including a proxy for password and refresh-token grants.
  • A new directory structure optimized for separating infrastructure and domain code. Groups your controllers, models, etc. by resource-type.
  • A modern exception handler for APIs.
  • A base controller class that gives sorting, filtering, eager loading and pagination for your endpoints.
  • A base repository class for requesting entities from your database.
  • A library for creating advanced structures of related entities.

Automatic Installation

bash
git clone https://github.com/gentritabazi/laravel-api-starter && cd laravel-api-starter && sh ./scripts/install.sh

This will:

  • Create the project.
  • Install the dependencies.
  • Create the .env file in the project root.
  • Generate the APP_KEY.
  • Create a symbolic link from public/storage to storage/app/public.

Now you just need to update your .env file as needed and install passport (check below how to install passport).

Manual Installation

First clone the repository.

bash
git clone https://github.com/gentritabazi/laravel-api-starter

Install dependencies.

bash
composer install

Copy the .env file an create and application key.

bash
cp .env.example .env && php artisan key:generate

Create a symbolic link from public/storage to storage/app/public.

bash
php artisan storage:link

Migrate the tables.

bash
php artisan migrate

Project comes with Passport include as the default authenticatin method. You should now install it using this command.

bash
php artisan passport:install

Copy-paste the generated secrets and IDs into your .env file like so.

bash
PERSONAL_CLIENT_ID=1
PERSONAL_CLIENT_SECRET=SECRET_HERE
PASSWORD_CLIENT_ID=2
PASSWORD_CLIENT_SECRET=SECRET_HERE

If you want to save it elsewhere or change the naming be sure to modify the LoginService in infrastructure/Auth/Services/LoginService.php

If you want to use docker to install composer dependencies use this script.

Test installation

You can quickly test if the authentication works by creating an user using the include command.

bash
php artisan users:add {first_name} {last_name} {email} {password}
Example: php artisan users:add Gentrit Abazi [email protected] mypassword

Now serve your application and try to request a token using cURL

bash
php artisan serve
curl -X POST http://localhost:8000/login -H 'Content-Type:application/json' -d '
{
    "email": "[email protected]",
    "password": "mypassword"
}'

This should return a token.

json
{
    "access_token": "TOKEN_HERE",
    "expires_in": 600
}

Now try to request all users GET /users using the newly issued token.

…

This should return a response like so

json
{
    "users": [
        {
            "id":1,
            "first_name": "Gentrit",
            "last_name": "Abazi",
            "email": "[email protected]",
            "name": "Gentrit Abazi"
        }
    ]
}

You can refresh a new token by requesting POST /login/refresh and logout using POST /logout.

Directory structure example

  • Laravel 7.0
  • Laravel 8.0.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPclean-laravel-apilarapilaravellaravel-api

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架