2017 © Pedro Peláez
 

library snowman

Laravel 4 Repository Pattern Generator

image

yhbyun/snowman

Laravel 4 Repository Pattern Generator

  • Friday, July 10, 2015
  • by yhbyun
  • Repository
  • 5 Watchers
  • 12 Stars
  • 190 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Fast Workflow in Laravel With Repository Pattern Generators

Build Status, (*1)

This Laravel package provides a variety of generators to speed up your development process. These generators include:, (*2)

  • snowman:baserepo
  • snowman:baserepointerface
  • snowman:model
  • snowman:presenter
  • snowman:repo
  • snowman:repointerface
  • snowman:reposerviceprovider
  • snowman:resource
  • snowman:scaffold

Requirements

  • PHP 5.4+
  • Laravel 4.2

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require yhbyun/snowman., (*3)

"require-dev": {
    "yhbyun/snowman": "dev-master"
}

Next, update Composer from the Terminal:, (*4)

composer update --dev

Once this operation completes, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array., (*5)

'Yhbyun\Snowman\SnowmanServiceProvider'

That's it! You're all set to go. Run the artisan command from the Terminal to see the new snowman commands., (*6)

php artisan

Usage

Scaffolding

The snowman:scaffold command will do a number of things for you:, (*7)

  • Generate a application folder
  • Generate a base repository
  • Generate a base repository interface
  • Generate a repository service provider

Example

php artisan snowman:scaffold acme

This single command will give you boilerplate for:, (*8)

  • Application Folder, (*9)

    • app/Acme
    • app/Acme/Presenters
    • app/Acme/Providers
    • app/Acme/Repos
    • app/Acme/Repos/Eloquent
  • app/Acme/Providers/RepoServiceProvider.php, (*10)

  • app/Acme/Repos/BaseRepoInterface.php
  • app/Acme/Repos/Eloquent/BaseRepo.php

Resources

The snowman:resource command will do a number of things for you:, (*11)

  • Generate a model
  • Generate a model repository
  • Generate a model repository interface
  • Generate a model presenter
  • Add binding in RepoServiceProvider.php

Example

php artisan snowman:resource acme post

This single command will do the following work:, (*12)

  • app/Acme/Presenters/PostPresenter.php
  • app/Acme/Providers/RepoServiceProvider.php : add binding
  • app/Acme/Repos/PostRepoInterface.php
  • app/Acme/Repos/Eloquent/PostRepo.php
  • app/Acme/Post.php

Configuration

You may want to modify your templates - how the generated files are formatted. To allow for this, you need to publish the templates that, behind the scenes, the generators will reference., (*13)

php artisan snowman:publish-templates

This will copy all templates to your app/templates directory. You can modify these however you wish to fit your desired formatting. If you'd prefer a different directory:, (*14)

php artisan snowman:publish-templates --path=app/foo/bar/templates

When you run the snowman:publish-templates command, it will also publish the configuration to app/config/packages/yhbyun/snowman/config/config.php. This file will look somewhat like:, (*15)

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Where the templates for the generators are stored...
    |--------------------------------------------------------------------------
    |
    */
    'model_template_path' => '/Users/yhbyun/my-project/app/templates/model.txt',
    'repo_template_path' => '/Users/yhbyun/my-project/app/templates/repo.txt',
    'repo_interface_template_path' => '/Users/yhbyun/my-project/app/templates/repo_interface.txt',
    'baserepo_template_path' => '/Users/yhbyun/my-project/app/templates/baserepo.txt',
    'baserepo_interface_template_path' => '/Users/yhbyun/my-project/app/templates/baserepo_interface.txt',
    'presenter_template_path' => '/Users/yhbyun/my-project/app/templates/presenter.txt',
    'reposerviceprovider_template_path' => '/Users/yhbyun/my-project/app/templates/reposerviceprovider.txt',


    /*
    |--------------------------------------------------------------------------
    | Where the generated files will be saved...
    |--------------------------------------------------------------------------
    |
    */

    'target_parant_path'    => app_path(),
];

Also, while you're in this file, note that you can also update the default target directory for each generator., (*16)

Laravel 4 Generators

This package is based upon a Jeffrey Way's generators, which is an indispensable packgage in Laravel., (*17)

The Versions

10/07 2015

dev-laravel5

dev-laravel5

Laravel 4 Repository Pattern Generator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YongHun Byun

laravel repository generator scaffold

11/02 2015

dev-master

9999999-dev

Laravel 4 Repository Pattern Generator

  Sources   Download

MIT

The Requires

 

The Development Requires

by YongHun Byun

laravel repository generator scaffold

21/05 2014

V0.1.1

0.1.1.0

Repository Pattern Generator

  Sources   Download

MIT

The Requires

 

by YongHun Byun

20/05 2014

v0.1

0.1.0.0

Repository Pattern Generator

  Sources   Download

MIT

The Requires

 

by YongHun Byun