百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-api-starter

> 后端框架
开源

⭐️ 在 Laravel 中构建您不会讨厌的 API。

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

⭐️ 在 Laravel 中构建您不会讨厌的 API。

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPclean-laravel-apilarapilaravellaravel-api

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

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