承接 andreacivita/api-crud-generator 相关项目开发

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

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

andreacivita/api-crud-generator

Composer 安装命令:

composer require andreacivita/api-crud-generator

包简介

Simple API Crud generator for Laravel

README 文档

README

Build Status codecov Codacy Badge Latest Stable Version License

Laravel | API CRUD Generator

This Generator package provides generators of Models, Controllers, Request, Routes & Tests for a painless development.

INSTALL

Install the package through Composer.

Run the Composer require command from the Terminal:

composer require andreacivita/api-crud-generator --dev

SETUP

Run this command from the Terminal

php artisan vendor:publish

Select andreacivita/api-crud-generator and setup it's complete.

USAGE

Managing all database

Usage of this package is very simple.

First, let's supposing I want to generate CRUD for all table in my db.

So, we run

php artisan make:crud --all

No further options required. Your setup is complete!

Interactive mode

You can manage a single table with interactive mode or manually (see next paragraph).

Just run

php artisan make:crud --interactive

Crud generator will ask you several data (Name of resource, Table name and use of timestamps).

Managing a single db table

Now i suppose generation of CRUD operations of Car db table.

Run this command:

php artisan make:crud Car

Done! You will have Car model (located in App/Model directory), CarController, CarRequest (used for input data) and Routes (located in routes/api.php).

OPTIONS

TABLE NAME

By default, DB Table's name is plural, while Model class name is singular (e.g. Table => Cars, Model => Car). You can change this behavior specifying the name in terminal

php artisan make:crud Car --table Car

This will create the same resources, but table name in model will be 'Car' (instead of default 'Cars')

TIMESTAMPS

By default, this packages will set all timestamps to false. You can change this doing this command:

php artisan make:crud Car --timestamps true

This will set 'timestamps=true' in Model class.

LARAVEL/PASSPORT INTEGRATION

By default, Routes will be not protected by passport. However, you can generate Passport-protected routes with:

php artisan make:crud Car --passport

This will set 'timestamps=true' in Model class.

ROUTING

Routes will follow Route::resource() Schema (default routing schema provided by Laravel).

Example: i'm generating Car crud

Route Method Operation
car GET Get all cars
car/{id} GET Find car by id
car POST Insert a new car
car/{id} PUT / PATCH Update car by id
car/{id} DELETE Delete car by id

Remember that all api routes have 'api/' prefix.

TESTING

When created CRUD structure (Controllers, Models, Request, Resource, Factory & Routes), this package generate Feature test file.

SETUP GENERATED CRUD

FACTORIES

Tests now require factory class to manipulate data. You should provide data schema into your factory class (using Faker), so you'll be able to test easily your API

VALIDATORS

Write better code will helps you so much! So, default behavior of Controllers is to force you to use validated data. You have to set all validation rules into your FormRequest class.

E.g. For Car Crud, you will set rules into your App\Request\CarRequest.php

CONTRIBUTING

This package is covered by MIT license. You are able to do whatever you want with this code.

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. You can see issues or enhancement and assign task for contributing :)

How can I thank you?

Star this repo or follow me on GitHub. And, if you want, you can share this link! :)

AUTHORS

This package has been originally developed by Andrea Civita
A special thanks goes to Bastianjoel for it's pull request

andreacivita/api-crud-generator 适用场景与选型建议

andreacivita/api-crud-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.25k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2018 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「crud」 「laravel」 「crud generator」 「API generator」 「laravel crud generator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 andreacivita/api-crud-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 andreacivita/api-crud-generator 我们能提供哪些服务?
定制开发 / 二次开发

基于 andreacivita/api-crud-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-11