The Skeleton Application is a simple ZF3-based application that contains most necessary things for creating your own website.
The skeleton application's code is stored on GitHub code hosting and can be publicly accessed by this link. However, you typically do not download the source code of the skeleton application directly, instead you use Composer dependency manager, as shown below.
First, you need to get the latest version of Composer. You do this with the following commands:
cd ~
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
The commands above change your working directory to be your home directory, download the composer-setup.php
installer script
to your working directory, run it, and, finally, remove the installer.
Once you run the commands above, you should have the
composer.phar
file in your working directory.
Now, type the following command from your command prompt:
php composer.phar create-project -sdev zendframework/skeleton-application helloworld
The command above downloads the Zend Skeleton Application to helloworld
directory and runs its
interactive installer. You now should answer several yes/no questions by typing y
or n
and pressing Enter.
Your answers will help the installer to determine which dependencies to install.
If you don't know what to answer, answer 'n' (no); you will be able to install additional dependencies
later at any time.
For the beginning, you can answer the questions the following way:
Do you want a minimal install (no optional packages)? Y/n
n
Would you like to install the developer toolbar? y/N
n
Would you like to install caching support? y/N
n
Would you like to install database support (installs zend-db)? y/N
n
Would you like to install forms support? y/N
y
Will install zendframework/zend-mvc-form (^1.0)
When prompted to install as a module, select application.config.php or modules.config.php
Would you like to install JSON de/serialization support? y/N
n
Would you like to install logging support? y/N
n
Would you like to install MVC-based console support? (We recommend migrating to zf-console, symfony/console, or Aura.CLI) y/N
n
Would you like to install i18n support? y/N
n
Would you like to install the official MVC plugins, including PRG support, identity, and flash messages? y/N
n
Would you like to use the PSR-7 middleware dispatcher? y/N
n
Would you like to install sessions support? y/N
n
Would you like to install MVC testing support? y/N
n
Would you like to install the zend-di integration for zend-servicemanager? y/N
n
Once you answer the questions, the installer will download and install all necessary packages and asks you to which config file you would like to inject information about installed modules. When prompted, type '1' and press Enter:
Please select which config file you wish to inject 'Zend\Form' into:
[0] Do not inject
[1] config/modules.config.php
[2] config/development.config.php.dist
Make your selection (default is 0):1
Remember this option for other packages of the same type? (y/N) y
Next, the installer will ask you if you would like to remove existing version control files from the project. Since you will probably store your web application in your own version control system (like Git) and do not need existing VCS files, type 'y' and press Enter:
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? y
Now copy composer.phar
file to your new helloworld
directory:
cp composer.phar helloworld
And final and very important step is enabling the development mode by typing the following command:
cd helloworld
php composer.phar development-enable
The development mode is typically used when you develop your application. When you enable the development mode additional "development" configuration files are created in your web application's
config
directory. In this mode your application may optionally load additional "development" modules. Configuration caching is also disabled in this mode allowing you to change your website's configuration files and see the changes immediately.Once you have finished the development, you can enable the production mode by typing the following:
php composer.phar development-disable
Congratulations! The hard work is done. Now let's look inside the helloworld
directory.