Using Generator

Now we'll use a component named com_flower with sakura and sakuras controllers to tutorial.

Please type:

$ php bin/windwalker generator init com_flower sakura.sakuras

Here is the success message.

p-2016-03-06-006

If CLI return Could not connect to MySQL. message, check your mysql account in configuration.php

The Mac environment may caused by mysql.sock issue, see This solution.

Discover Component

Go to Joomla admin and discover this component.

image

Install it.

image

Then, click image into component view.

image

The database has auto created:

image

Add Subsystem

This command can add two controllers, item edit and list:

$ php bin/windwalker add subsystem com_flower rose.roses

We call these two MVC groups an subsystem.

Folder Structure of Component

Admin

image

Folder Desc
asset CSS & JS etc.
etc Config files
controller Controllers
helper / helpers Helper classes. Plural folder is for legacy use.
images Images
language Languages, site language is in admin together.
model Models
sql The SQL needed when component install
src Some useful classes, using PSR-0 autoloading here.
table Tables, Active Record.
view Views

Site

Folder Desc
asset CSS & JS files
controller Controllers
helper Helpers. If you want to use some classes both in site and admin, put it in src
images Images
model Models
sql The SQL needed when component install
view Views

Include Component Library in Other Extensions

There is an important file in admin src/init.php.

If you include this file, it will load component required classes and windwalker.


Found a typo? Help us improve this document.

This document is for Windwalker Joomla RAD, if you are finding Windwalker PHP framework, please see: Windwalker Framework