Download the PHP package mediactive-digital/laravel-4-generators without Composer

On this page you can find all versions of the php package mediactive-digital/laravel-4-generators. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-4-generators

Fast Workflow in Laravel With Custom Generators

Build Status

This Laravel package provides a variety of generators to speed up your development process. These generators include:

Installation

Want a 5-minute video overview?

Laravel 4.2 and Below

Begin by installing this package through Composer. Edit your project's composer.json file to require way/generators.

"require-dev": {
    "way/generators": "~2.0"
}

There is no support for Laravel 5, as the framework now includes a number of generators out of the box.

Next, update Composer from the Terminal:

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.

'Way\Generators\GeneratorsServiceProvider'

That's it! You're all set to go. Run the artisan command from the Terminal to see the new generate commands.

php artisan

Next, update Composer from the Terminal:

composer update --dev

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

'Way\Generators\GeneratorsServiceProvider'

That's it! You're all set to go. Run the artisan command from the Terminal to see the new generate commands.

php artisan

Usage

Think of generators as an easy way to speed up your workflow. Rather than opening the models directory, creating a new file, saving it, and adding the class, you can simply run a single generate command.

Migrations

Laravel offers a migration generator, but it stops just short of creating the schema (or the fields for the table). Let's review a couple examples, using generate:migration.

php artisan generate:migration create_posts_table

If we don't specify the fields option, the following file will be created within app/database/migrations.

Notice that the generator is smart enough to detect that you're trying to create a table. When naming your migrations, make them as descriptive as possible. The migration generator will detect the first word in your migration name and do its best to determine how to proceed. As such, for create_posts_table, the keyword is "create," which means that we should prepare the necessary schema to create a table.

If you instead use a migration name along the lines of add_user_id_to_posts_table, in that case, the keyword is "add," signaling that we intend to add rows to an existing table. Let's see what that generates.

php artisan generate:migration add_user_id_to_posts_table

This will prepare the following boilerplate:

Notice how, this time, we're not doing Schema::create.

Keywords

When writing migration names, use the following keywords to provide hints for the generator.

Generating Schema

This is pretty nice, but let's take things a step further and also generate the schema, using the fields option.

php artisan generate:migration create_posts_table --fields="title:string, body:text"

Before we decipher this new option, let's see the output:

Nice! A few things to notice here:

To declare fields, use a comma+space-separated list of key:value:option sets, where key is the name of the field, value is the column type, and option is a way to specify indexes and such, like unique or nullable. Here are some examples:

Please make note of the last example, where we specify a character limit: string(30). This will produce $table->string('username', 30)->unique();

It is possible to destroy the table by issuing:

php artisan generate:migration delete_posts_table

As a final demonstration, let's run a migration to remove the completed field from a tasks table.

php artisan generate:migration remove_completed_from_tasks_table --fields="completed:boolean"

This time, as we're using the "remove" keyword, the generator understands that it should drop a column, and add it back in the down() method.

Models

php artisan generate:model Post

This will create the file, app/models/Post.php and insert the following boilerplate:

Views

The view generator is fairly simple.

This command will create an empty view, /app/views/admin/reports/index.blade.php. If the provided directory tree does not exist, it will be created for you.

Seeds

Laravel provides us with a flexible way to seed new tables.

php artisan generate:seed users

Set the argument to the name of the table that you'd like a seed file for. This will generate app/database/seeds/UsersTableSeeder.php and populate it with:

This will give you a basic bit of boilerplate, using the popular Faker library. This is a nice way to seed your DB tables. Don't forget to pull in Faker through Composer!

Pivot

When you require a new pivot table, the generate:pivot table expedites the process of creating the appropriate migration.

Simply pass the name of the two tables that require a joining pivot table. For orders and users, you might do:

This will create the following migration:

Notice that it correctly sets the table name according to your two provided tables, in alphabetical order. Now, run php artisan migrate to create your pivot table!

Resources

The generate:resource command will do a number of things for you:

When triggering this command, you'll be asked to confirm each of these actions. That way, you can tailor the generation to what you specifically require.

Example

Imagine that you need to build a way to display posts. While you could manually create a controller, create a model, create a migration and populate it with the schema, and then create a table seeder...why not let the generator do that?

If you say yes to each confirmation, this single command will give you boilerplate for:

Scaffolding

The scaffolding generator is similar to generate:resource, except it will add some beginning boilerplate to these files, as a convenience.

For instance, when running generate:scaffold post, your controller boilerplate will be:

Please note that you're encouraged to modify this generated controller. It simply provides a starting point.

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.

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:

When you run the generate:publish-templates command, it will also publish the configuration to app/config/packages/way/generators/config/config.php. This file will look somewhat like:

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

Shortcuts

Because you'll likely type these commands over and over, it makes sense to create aliases.

These can be stored in, for example, your ~/.bash_profile or ~/.bashrc files.


All versions of laravel-4-generators with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version ~6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mediactive-digital/laravel-4-generators contains the following files

Loading the files please wait ....