2017 © Pedro Peláez
 

library laravel-autodb

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

image

xmarkclx/laravel-autodb

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

  • Sunday, March 13, 2016
  • by xmarkclx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Introduction

Automatically creates database based on few PHP documentation comments., (*1)

  • 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:, (*2)

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

We run:, (*3)

    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., (*4)

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., (*5)

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., (*6)

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., (*7)

The Versions

13/03 2016

dev-master

9999999-dev http://markcl.net

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

  Sources   Download

MIT

The Requires

 

The Development Requires

database model create automatic migrate automagic

13/03 2016

1.0.x-dev

1.0.9999999.9999999-dev http://markcl.net

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

  Sources   Download

MIT

The Requires

 

The Development Requires

database model create automatic migrate automagic

13/03 2016

1.0.0

1.0.0.0 http://markcl.net

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

  Sources   Download

MIT

The Requires

 

The Development Requires

database model create automatic migrate automagic