Drupal 8 Console scaffolding module generator

Note: this is an archived site. The current site can be found at http://drupalcampla.com.
Day: 
Sunday
Time: 
2:30p
Room: 

Every modern framework nowadays provides a scaffolding tool code generator for speeding up the process of starting a new project and avoid early repetitive tasks.

The purpose of this project is to leverage the Symfony Console Component to provide a CLI tool to automate the creation of drupal 8 modules by generating the directory structure for a module, routing, controllers, forms, services, plugins and required configuration files.

It supports adding services using Dependency Injection on class generation.

What is out of the box?

  • Generates module and info files.
  • Generates PSR-4 compliant directory structure for a module.
  • Register routes on YML files and map to PHP Classes (controller, form, service).
  • Create classes adding namespaces, uses and also the extend and implements keywords when required.
  • Support adding services using Dependency Injection on class generation.

During this session you will learn about the concepts and components introduced on Drupal 8 and by the end you will have the basic knowledge required for writing a Drupal 8 module.

Some topics that will be mentioned on this session

  • HTTP Request/Response
  • Composer
  • Annotations
  • Namespaces
  • Services
  • Service Container
  • Dependency Injection
  • Routing
  • Controller

This session will include a demo of https://drupal.org/project/console (scaffolding module generator)

Who will benefit of using an automatic code module generator ?

  • Module Maintainers & Developers
    Create & Migrate contributed modules to Drupal 8.
  • Drupal Trainers & Consultors
    Train developers on Drupal 8.
  • Drupal Shops
    Reduce module development time for Drupal 8.
Category: 
Code and Development
Skill: 
Intermediate
Duration: 
One hour

Comments

Any clue why this does not work on a global download using the composer.json from GITHUB project. The command line is what you list in your online documentation for installing the DrupalAppConsole application.

**********************
Welcome to Git (version 1.8.1.2-preview20130201)

$ cd DrupalAppConsole
name@MY_COMPUTER /c/software/drupal/DrupalAppConsole
$ ls
bin composer.json composer.lock vendor
name@MY_COMPUTER /c/software/drupal/DrupalAppConsole
$ COMPOSER_BIN_DIR=bin composer.phar require --dev drupal/console:~0.1
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package drupal/console 1.0.0 could not be found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
see f
or more details.
Read for further common
problems.
Installation failed, reverting ./composer.json to its original content.
name@MY_COMPUTER /c/software/drupal/DrupalAppConsole
$

Also tried ~0.2 and 0.2.10 (the current version according to Packagist)

Still getting the same error.

It doesn't seem to be the minimum stability setting, which is set to "dev" in the composer.json.

The original composer.json does not have "drupal/console" in it. So that is why you have the command line to add it in, I guess.

But it is not working at all. So impossible to install and test.

Hi Peter

you should run the installer

$COMPOSER_BIN_DIR=bin composer.phar require --dev drupal/console:~0.1

inside your drupal8 root installation directory

I actually tried that, it did not work either. But I'll do it again and give you the output.

$ COMPOSER_BIN_DIR=bin composer.phar require --dev drupal/console:~0.1
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update <--- NOTE that nothing got installed.
Generating autoload files
user@MyComputer ~/documents/My Web Sites/drupal8.1/drupal (8.x)
$

The bin directory was not created and there is no "console" folder or app in it.

I'm new to composer. There can be only one composer.json per project directory. So the command line should be adding things to my Drupal 8 composer.json file, then downloading the necessary application files, correct?

**************

The Vagrant instance crashed and burned on me. I got only a blank Ubuntu screen. So not having luck with that either.

I tried to do a "global" installation by running your project JSON in a folder then ADDING the console to THAT (which was what my first post here was about - after I tried other things).

I recall at earlier versions we provided a console.phar file this was a stand alone console distribution that could be something more what you are trying to do if I understand correctly.

We are talking about bringing back the console.phar file and make console run as stand alone command.

Okay, problem solved, I think. I was trying to install on a Drupal 8.1 instance, since I have
been working with the "latest and greatest." But it appears that the console app works
ONLY with the Dev version of Drupal 8.0. So I reinstalled the latest Dev 8.0 (to fix my
broken one), and the command line composer installation works. Now I will have to see if
the app itself works.

You might want to make a note that the composer installation does not (YET?) work with Drupal 81.

$ cd drupal8
user@COMPUTER ~/documents/My Web Sites/drupal8
$ COMPOSER_BIN_DIR=bin composer.phar require --dev drupal/console:~0.1
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing composer/installers (v1.0.18)
Loading from cache

- Installing symfony/finder (v2.4.9)
Loading from cache

- Installing symfony/console (v2.4.9)
Loading from cache

- Installing drupal/console (0.2.10)
Loading from cache

Writing lock file
Generating autoload files
user@COMPUTER ~/documents/My Web Sites/drupal8
$