📜 ⬆️ ⬇️

Using Zend_Tool

Zend Framewrok Application

Zend Framework is on the way the elders Brothers in Mind - Zend Tool will help you in quickly creating a project based on ZF.


First we need to download the Zend Framework from the developers site, or use the SVN repository (from all this stuff we need the bin and library / Zend folder, the rest is not needed yet):
')
~ $ svn co http: // framework.zend.com / svn / framework / standard / trunk / bin / . / bin
~ $ svn co http: // framework.zend.com / svn / framework / standard / trunk / library / Zend. / library / Zend


Note : if you are true-linux-comed and often create projects on ZF, then drop the zf.sh file into / usr / bin (or any other way where the system can find it), and the Zend folder is where you have the included_path for PHP (run the command php -i | grep include_path)


We should have the following directory structure:

 htdocs
 | - bin
 |  | - zf.bat
 |  | - zf.php
 |  `- zf.sh
 `- library
      `- Zend


Now open the console go to the htdocs directory and type:
# don't forget chmod a + x ./bin/zf.sh
~ $. / bin / zf.sh create project. /


Note : the utility was tested under Linux, it is likely that it will work under Windows too (use zf.bat)


After that, we should have a project created, and after visiting the page you should see something similar to the picture at the very beginning of the article. The directory structure will look like this:

 htdocs
 | - application
 |  | - Bootstrap.php
 |  | - configs
 |  |  `- application.ini
 |  | - controllers
 |  |  | - ErrorController.php
 |  |  `- IndexController.php
 |  | - models
 |  `- views
 |  | - helpers
 |  `- scripts
 |  | - error
 |  |  `- error.phtml
 |  `- index
 |  `- index.phtml
 | - library
 | - public
 |  `- index.php
 `- tests
     | - application
     |  `- bootstrap.php
     | - library
     |  `- bootstrap.php
     `- phpunit.xml


Go ahead - we will create a controller and actions:
# create a users controller and two actions
~ $. / bin / zf.sh create controller users
~ $. / bin / zf.sh create action login users
~ $. / bin / zf.sh create action logout users


We look at the result (file UsersController.php):
<? php
class UsersController extends Zend_Controller_Action
{
public function init ( )
{
/ * Initialize action controller here * /
}
public function indexAction ( )
{
// action body
}
public function loginAction ( )
{
// action body
}
public function logoutAction ( )
{
// action body
}
}


For each action, an almost empty view script will be created:
< center > View script for controller < b > users < / b > and script / action name < b > login < / b > < / center >


Note : If the public folder is not the root folder, then add the “RewriteBase / public /” rule to the “/ public /.htaccess” file after “RewriteEngine On”


In addition to this functionality, there are still the following "features":


In TODO developers:


Useful articles:


Link to blog post: Using Zend_Tool

Source: https://habr.com/ru/post/58911/


All Articles