Skip to content
/ jc-bach Public
forked from eddieajau/jc-bach

Joomla Composers: Bach - your basic command line application built on the Joomla Platform.

Notifications You must be signed in to change notification settings

Astyk/jc-bach

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bach - Your basic command line application

Like his Minuet in G (incidentally, the first classical piece I learned on the piano), Bach is a very simple skeleton for a command line application. It demonstrates:

  • how to bootstrap the Joomla Platform;
  • how to provide a configuration file for an application;
  • how to set up the application source code to the auto-loader specifications;
  • how to identify command line options; and
  • how to use a model and its state.

Overview

bin/
This folder contains the executatable files.
code/
This folder contains all the custom application code.
config/
This folder contains the configuration file for the application.

Note that within the code/ folder, all the classes are prefixed with "Bach" and then all the classes follow the auto-loader naming convention. The prefix is specified in the last line of the code/bootstrap.php file:

// Setup the autoloader for the Bach application classes.
JLoader::registerPrefix('Bach', __DIR__);

You can search-and-replace the word "Bach" and replace it with your own application name. You can also search-and-replace "{COPYRIGHT}".

This type of architecture could be used to support a single command-line application, or it could be used for many different variants, each with its own executable in bin/, but using a common code library under code/.

Requirements

  • PHP 5.3

Installation

This application assumes that you have cloned it and the Joomla Platform into a folder called "joomla" under the same parent. For example:

/parent
../Bach    <-- this repository
../joomla  <-- the Joomla platform

The simplest way to do this is like this:

mkdir Composers
cd Composers
git clone git://github.com/joomla/joomla-platform.git joomla
git clone git://github.com/eddieajau/jc-bach.git Bach

Such a setup will allow the application to auto-discover the Joomla Platform. Alternatively, you can configure some environment variables so that your applications know where to find the Joomla Platform (probably the way you would do it on the production server).

JPLATFORM_HOME=/path/to/joomla/platform

Once you have cloned this repository, you can then push it to one your have created for your own application.

Running the application

To run the application, navigation to the "/bin" folder and make sure the "run" file is executable. Then run it directly (if on a *nix operating system), or by invoking php like this (you loose the ability to use command line arguments for the script itself doing it this way):

php -f run

Consult your operating system requirements for putting the script in your execution path so that you can run it from any folder.

About the Joomla Composers

The Joomla Composers are a suite of skeleton git repositories that can be used to kick-start your own Joomla Platform Projects. You can clone any of the repositories as a base for building your own application, or cherry-pick what you need.

About

Joomla Composers: Bach - your basic command line application built on the Joomla Platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published