承接 xmarkclx/laravel-autodb 相关项目开发

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

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

xmarkclx/laravel-autodb

Composer 安装命令:

composer require xmarkclx/laravel-autodb

包简介

Automatically creates database for Laravel based on a few PHP documentation comments.

README 文档

README

Automatically creates database based on few PHP documentation comments.

  • Easy to use
  • Stable
  • Fully Tested: Major Features are tested for stability
  • Framework agnostic
  • Pleasurable to work with
  • Supports Laravel / Eloquent

Usage

Install via composer

composer require xmarkclx/laravel-autodb

Create Database Comments

Given we have a comment on a class like so:

/**
 * Class Example
 *
 * @db===
 * @property string $avatar_url
 * @property int $id #increments         
 * @db===
 **
 * @package App
 */
 class Example implements AutogeneratedDBFields
 {

We run:

    php artisan autodb

What happens:

  • Will create table example if not yet created.
  • In that table:
    • Creates string called avatar_url.
    • Creates integer called id that is a primary key and auto-increments.

FAQs

Why?

  • Creating database migrations and changing them is time consuming. This will make it faster.
  • Also, this would avoid migration conflicts that happens when multiple migrations, try to modify the same database fields.
  • Furthermore, with this method, you can automatically get autocomplete suggestions on your IDE for the database fields due to it being related to phpdoc tags.
  • No more need to open database viewer to know what fields the model has, just look at the model file.
  • Agile Friendly: Make database improvements fast.

Why not just make this tool create migrations?

Well, we can, and it's not hard, but I don't have time for that yet.

If you want to help, you just need to make an assembler for that, just see how src/LaravelModelAssembler.php works and you can make a LaravelMigrationAssembler.php or something that assembles migrations instead of the database.

Example

  • I create migration where name is now an integer based on a test.
  • Production server gets my migration and migrated it.
  • Production server names are now integers.
  • So that's why it was decided to auto migrate data instead of creating migration files.

I want to help make this project better.

See docs/Architecture.md for how it is architected.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固