luciocodeigniter/api-ci4-car-workshop
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:
- intl
- mbstring
- 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
luciocodeigniter/api-ci4-car-workshop 适用场景与选型建议
luciocodeigniter/api-ci4-car-workshop 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 luciocodeigniter/api-ci4-car-workshop 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 luciocodeigniter/api-ci4-car-workshop 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-26