Wednesday, January 23, 2013

ZF2 with macports' ZendFramework2 port

Quick Handreichung how to set up the skeleton application Zend Framework 2 (ZF2) on OS X, using macports' distribution of ZF2. Otherwise you'd have to download/install ZF2 every time for every project - redundancy and version confusion ahoi.
The ZF2 skeleton application is a good starting point for your own ZF2 development.

Quick facts:

  • OS X 10.8
  • ZF2 2.0.6
  • PHP 5.3 (from macports - hint: will be installed anyway with macports' version of ZF2)
  • Apache 2.2.23 (from macports)


$> cd /opt/local/ww
$> sudo git clone git://github.com/zendframework/ZendSkeletonApplication.git zf2.git

$> tree zf2.git
zf2.git
├── LICENSE.txt
├── README.md
├── composer.json
├── composer.phar
├── config
│   ├── application.config.php
│   └── autoload
│       ├── README.md
│       ├── global.php
│       └── local.php.dist
├── data
│   └── cache
├── init_autoloader.php
├── module
│   └── Application
│       ├── Module.php
│       ├── config
│       │   └── module.config.php
│       ├── language
│       │   ├── ar_SY.mo
│       │   ├── ar_SY.po
│       │   ├── cs_CZ.mo
│       │   ├── cs_CZ.po
│       │   ├── de_DE.mo
│       │   ├── de_DE.po
│       │   ├── en_US.mo
│       │   ├── en_US.po
│       │   ├── es_ES.mo
│       │   ├── es_ES.po
│       │   ├── fr_CA.mo
│       │   ├── fr_CA.po
│       │   ├── fr_FR.mo
│       │   ├── fr_FR.po
│       │   ├── it_IT.mo
│       │   ├── it_IT.po
│       │   ├── ja_JP.mo
│       │   ├── ja_JP.po
│       │   ├── nb_NO.mo
│       │   ├── nb_NO.po
│       │   ├── nl_NL.mo
│       │   ├── nl_NL.po
│       │   ├── pl_PL.mo
│       │   ├── pl_PL.po
│       │   ├── pt_BR.mo
│       │   ├── pt_BR.po
│       │   ├── ru_RU.mo
│       │   ├── ru_RU.po
│       │   ├── tr_TR.mo
│       │   ├── tr_TR.po
│       │   ├── zh_CN.mo
│       │   ├── zh_CN.po
│       │   ├── zh_TW.mo
│       │   └── zh_TW.po
│       ├── src
│       │   └── Application
│       │       └── Controller
│       │           └── IndexController.php
│       └── view
│           ├── application
│           │   └── index
│           │       └── index.phtml
│           ├── error
│           │   ├── 404.phtml
│           │   └── index.phtml
│           └── layout
│               └── layout.phtml
├── public
│   ├── css
│   │   ├── bootstrap-responsive.min.css
│   │   ├── bootstrap.min.css
│   │   └── style.css
│   ├── images
│   │   ├── favicon.ico
│   │   └── zf2-logo.png
│   ├── index.php
│   └── js
│       ├── bootstrap.min.js
│       ├── html5.js
│       └── jquery.min.js
└── vendor
    ├── README.md
    └── ZF2


Note the vendor/ZF2 directory above - comes in empty.

$> sudo port install ZendFramework2
--->  Computing dependencies for ZendFramework2
   <snip />
--->  Cleaning ZendFramework2
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.

Now comes the the important part: linking macports' ZF2/library to the actual ZF2-directory of the git repository.

$> cd /opt/local/www/zf2.git/vendor/ZF2
$> sudo ln -s /opt/local/www/ZendFramework/library
$> ls -al

total 8
drwxr-xr-x  3 root  admin  102 23 Jan 16:04 .
drwxr-xr-x  5 root  admin  170 23 Jan 16:02 ..
lrwxr-xr-x  1 root  admin   36 23 Jan 16:04 library -> /opt/local/www/ZendFramework/library

Configure /opt/local/www/zf2.git/public to be the DocumentRoot of your local webserver and you should see ZF2's starting screen.

Ta-Ta!!!

No comments:

Post a Comment