Skip to content

Setup Zend

Setup Zend

Zend Framework is now Laminas. This example installs a Laminas MVC 3.x application with Composer from inside the Devilbox PHP container while keeping the historic page title for existing links.

example zend documentation

Overview

The following configuration will be used:

Project nameVirtualHost directoryDatabaseTLD_SUFFIXProject URL
my-zend/shared/httpd/my-zendn.a.lochttp://my-zend.loc br https://my-zend.loc

[!NOTE] Inside the Devilbox PHP container, projects are always in /shared/httpd/. On your host, projects are stored in ./data/www/ by default. This path can be changed via env-httpd-datadir.

Walk through

It will be ready in six steps:

  1. Start Devilbox
  2. Enter the PHP container
  3. Create a new VirtualHost directory
  4. Install Laminas 3.x via Composer
  5. Symlink the webroot directory
  6. Configure DNS and open the site

1. Start Devilbox

Terminal window
host> ./dvl.sh up

2. Enter the PHP container

All work will be done inside the PHP container:

Terminal window
host> ./dvl.sh shell

* enter-the-php-container * work-inside-the-php-container * available-tools

3. Create new vhost directory

The vhost directory defines the name under which your project will be available.

Terminal window
[email protected] in /shared/httpd $ mkdir my-zend
[email protected] in /shared/httpd $ cd my-zend

env-tld-suffix

4. Install Laminas 3.x

Install the Laminas MVC skeleton application:

Terminal window
[email protected] in /shared/httpd/my-zend $ composer create-project --prefer-dist laminas/laminas-mvc-skeleton laminas

How the directory structure looks after installation:

Terminal window
[email protected] in /shared/httpd/my-zend $ tree -L 1
.
└── laminas
1 directory, 0 files

The web server expects every project document root in <vhost dir>/htdocs/. Laminas keeps its entry point in public/, so symlink it to htdocs:

Terminal window
[email protected] in /shared/httpd/my-zend $ ln -s laminas/public/ htdocs
Terminal window
[email protected] in /shared/httpd/my-zend $ tree -L 1
.
├── laminas
└── htdocs -> laminas/public
2 directories, 0 files

6. DNS record and browser

If Auto DNS is configured you can skip the hosts entry. Otherwise add this line to your host operating system’s hosts file:

Terminal window
127.0.0.1 my-zend.loc

Open http://my-zend.loc or https://my-zend.loc to see the Laminas welcome page.

  • howto-add-project-hosts-entry-on-mac
  • howto-add-project-hosts-entry-on-win
  • setup-auto-dns

Next steps

Use bundled batteries

* devilbox-intranet-adminer * devilbox-intranet-phpmyadmin * devilbox-intranet-phppgadmin * devilbox-intranet-phpredmin * devilbox-intranet-phpmemcachedadmin

Enhance the Devilbox

* setup-valid-https * setup-auto-dns * configure-php-xdebug

Add services

  • custom-container-enable-blackfire
  • custom-container-enable-rabbitmq
  • custom-container-enable-solr
  • custom-container-enable-varnish