Chapter: Creating an application
« Install requirements | ^ Getting started | Server configuration » |
− Table of content
The easiest way to create a Jelix application, is to use the command bin/create-jelix-app
.
It creates a skeleton for your application.
You must first install sources of Jelix, with Composer or with a zip package downloaded from jelix.org.
Installing sources with Composer ¶
To install Composer, go at https://getcomposer.org.
Create a composer.json
for your project in a new directory (ex: myproject
)
which will be dedicated to your application. Here is an example of its content:
{
"name": "myorganisation/myproject",
"type": "application",
"require": {
"jelix/jelix": "dev-jelix-1.7.x"
},
"minimum-stability": "stable"
}
You can also create this file with the command composer init
.
In the directory, launch Composer to install Jelix packages:
cd myproject
composer install
A new directory vendor
appears, in which Jelix and other libraries are
installed. Jelix is then into vendor/jelix/jelix/
.
In other page of the manual, if it is refered to the lib/
directory of Jelix,
it is vendor/jelix/jelix/lib/
.
The command create-jelix-app
is into vendor/bin/
.
Installing sources from jelix.org ¶
Go into the download page of jelix.org to download a tar.gz or a zip package of Jelix. This archive contains all files of the framework and other libraries.
Then extract files from the archive with winzip, unzip, tar or any other tools supporting the zip or tar.gz format. Example with tar:
tar xvzf jelix-1.7.2.tar.gz
A directory jelix-1.7.2
is then created containing a lib/
and a bin/
directory.
Move these directories into your project directory.
The command create-jelix-app
is into bin/
.
Lauching create-jelix-app ¶
In a console, change directory to where is create-jelix-app
, and run:
php create-jelix-app /path/to/myproject/myapp
myapp
will be the name of your application.
create-jelix-app
create a myapp/
directory with the given path. Its content is:
myapp/
app/
system/ static configuration files of your application
responses/ contains a class implementing a default HTML response.
themes/ different possible themes of your application
overloads/ will contain different files you will choose to overload
from those in your modules
install/ scripts and files to initialize the application
modules/ modules owned by your application
plugins/ plugins owned by your application
temp/ all temporary files will be stored in it
var/
config/ configuration files of your application for the current environment
log/ optional log files
themes/ themes installed during the life of the application
overloads/ like app/overloads, but for files created during the life of the application.
www/ root of the public files, readable directly by a browser
First launch of the application ¶
Now that your application is created, you can test it by launching a web server, like the PHP's one (use it only for development!).
cd myapp
php -S localhost:8080 -t www
Then go to http://localhost:8080
with your browser.
If you want to use an other web server, like Apache or Nginx, you have more settings. See the next chapter.