承接 luciocodeigniter/api-ci4-car-workshop 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

luciocodeigniter/api-ci4-car-workshop

最新稳定版本:v1.0.0

Composer 安装命令:

composer create-project luciocodeigniter/api-ci4-car-workshop

包简介

API for creating customers, their cars, their addresses, creating services and employees. Creation of customer vehicle maintenance with Codeigniter 4. The API provides registration and authentication.

README 文档

README

Features

  • Register
  • Login
  • CRUD Customers
  • CRUD Cars customers
  • CRUD Address customers
  • CRUD Employees
  • CRUD Services
  • CRUD Maintenance cars
  • CRUD Services Maintenance cars association

Server Requirements

  • Developed PHP 8.2.7 and Codeigniter 4.4.4
  • The following extensions need to be enabled:
  1. intl
  2. mbstring
  3. json

Installation

1 - Install the project using composer (requires Composer):

composer create-project luciocodeigniter/api-ci4-car-workshop

2 - Rename the .env-exemple.txt file to .env which can be found in the project root

3 - Place the information in the .env file as per the following example:

#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------

CI_ENVIRONMENT = development

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

app.baseURL = 'https://exemplo.com/'
app.indexPage = ''


#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

database.default.hostname = localhost
database.default.database = db-name
database.default.username = db-user
database.default.password = db-password
database.default.DBDriver = MySQLi
database.default.DBPrefix =
database.default.port = 3306


#--------------------------------------------------------------------
# JWT Authenticator
#--------------------------------------------------------------------
authjwt.keys.default.0.secret = oGPvp9lLkgTvcqlVIU3rJE46uJmedapcW3EJ6cr/9gw=

Creating and populating tables in the database.

1 - At the root of the project, open the terminal and run the following command:

php spark api:init

2 . If you want to reset the database to its original state, simply run the following command in the root of the project:

php spark api:reset

3 - If you want to change the number of records to be created with seeders, simply change the TOTAL_STEPS constant within each file, which can be found in app\Database\Seeds:

//...

/**
* How many records do you want to create
*/
private const TOTAL_STEPS = 100; //<---- Change here

//..

Registering on the application

1 . Send a POST request to https://exemplo.com/api/register

If the request was validated, you should see the access_token in the response:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI8SXNzdWVyIG9mIHRoZSBKV1Q-Iiwic3ViIjoiMSIsImlhdCI6MTcwNjMxMDI5NSwiZXhwIjoxNzA2MzEzODk1fQ.G8SaDs_vaMqFnzELllLbfErKSUvYiofNoGzhMYQkqUg"
}

When making all future requests to the API, the client should send the JWT in the Authorization header as a Bearer token.

Authenticating in the application

1 . Send a POST request to https://exemplo.com/api/login

If the request was validated, you should see the access_token in the response:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI8SXNzdWVyIG9mIHRoZSBKV1Q-Iiwic3ViIjoiMSIsImlhdCI6MTcwNjMxMDI5NSwiZXhwIjoxNzA2MzEzODk1fQ.G8SaDs_vaMqFnzELllLbfErKSUvYiofNoGzhMYQkqUg"
}

When making all future requests to the API, the client should send the JWT in the Authorization header as a Bearer token.

- Customers endpoints

List all

GET https://exemplo.com/api/customers

Get single

GET https://exemplo.com/api/customers/1

Create

POST https://exemplo.com/api/customers

Update

PUT or PATCH https://exemplo.com/api/customers/1

Delete

DELETE https://exemplo.com/api/customers/1

- Paginating records. All endpoints that list records return 20 per page. You can change this by sending the request as follows:

GET api/endpoint?page=1&perPage=50

- Others endpoints

https://exemplo.com/api/cars
https://exemplo.com/api/employees
https://exemplo.com/api/services
https://exemplo.com/api/maintenance
https://exemplo.com/api/maintenance-services

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固