Monday, September 30, 2019
Beginners Guide for Zend Framework 2.0
Beginners Guide for Zend Framework 2. 0 When it comes to open source software and applications, Zend Framework is one of the most preferred platforms for web applications. Zend Framework 2. 0 has been released to overcome the common issues of the previous version and provide an advanced framework for the development of web applications. You can expect a lot of new features including cloud computing, superior event management, and advanced features for event tracking. The Beginners Guide for Zend Framework 2. is a series which will help you in getting started with Zend Framework 2. 0. We are going to discuss each and every aspect of ZF2. 0 with practical example. Whatââ¬â¢s new in Zend Framework 2. 0 Before starting with ZF2. 0, let us find out whatââ¬â¢s new in this version â⬠¢ â⬠¢ â⬠¢ â⬠¢ â⬠¢ â⬠¢ â⬠¢ â⬠¢ New and refactored Autoloaders Improved Exception System Advance and refactored View Component New Cloud Infrastructure component New and advan ced Event Manager component New Plugin Broker Strategy Rewritten Session Component New Dependency Injection ComponentPost 1 of series ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â How to setup Zend Framework 2. 0 Zend Framework 2. 0 is a whole new outfit for Zend Framework and you will find new components, renamed and changed components, and addition of advanced services for better web applications. You would be amazed with the bug fixes and error controlling components available with ZF2. 0. So you need a lot of modifications for this latest version and let us find out how to start working with ZF2. 0. Installing Zend framework 2. First of all you need to download the setup of ZF2. 0 and the best option is to download Zend Framework Minimal Package fo r Windows including PHP 5. 3 in it. Save the file in the library folder as library/zend. There are different methods for installing ZF2. 0 on your machine: â⬠¢ â⬠¢ â⬠¢ Installation Using Pear Installation Using Subversion (svn) Using Git Installation with Pear For the users having Pear enabled on their system, the best method of installing ZF 2. 0 is by using Pear and following two simple command as: pear channel-discover pear. zfcampus. org pear install zfcampus/zfInstallation with Subversion (svn) Users having Subversion running on their system can download the software from public repository and you are not required to download the whole version, you can simply upgrade the frame work with new releases. Installing with Git Many programmers prefer Git for downloading the latest software upgrades and you can use Git for the latest version of ZF 2. 0. Getting ready for your first ZF Project Zend Framework has some specific system requirements like adding frame work in inc lude_path and access to scripts located outside the document.You need to have a proper directory structure before starting with the project and let us find out the best directory structure for your first ZF project 1. docroot/ 2. index. php 3. application/ 4. 5. 6. 7. 8. 9. default/ controllers/ IndexController. php FooController. php models/ views/ 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. scripts/ index/ foo/ helpers/ filters/ blog/ controllers/ IndexController. php models/ views/ scripts/ index/ helpers/ filters/ news/ controllers/ IndexController. php ListController. hp models/ views/ scripts/ index/ list/ helpers/ Filters/ Each of the directories has a specific role and use, let us find out the importance of each of these directories Application: Application directory is meant for all the codes used for the application. Configs: This directory is responsible for the overall application. Modules: Modules are required for at different stages of development so make sure to create a directory for modules for any future requirements of the project. Data: Data directory is responsible for holding volatile and temporary data including sessions, logs, cache, and even the upload data.This directory will act as an easy to find data block for your application. Library: This directory is used for storing different libraries that are throughout the application. Add this directory in include_path for any reference and requirement. Scripts: Script directory is used for maintaining all the scripts including patches, command line, and cron scripts used in the application. Docs: This directory is created for storing data generated in the application and data directly used in the application. Setting Up bootstrapBootstrap is the entry and exit point for all the command in any given applications including requests, response, route, and even dispatch commands. For setting up your Bootstrap, create index. php file and a dd the following code in your application. Background Process: First of all, you need to define all the main directories as contants for easy access and then initiate Zend/Application/Application for starting the application. The command bootstrap() is used for booting the application and then transfer the control to the original bootstrap of the application.For higher security, make sure to mention minimum details in index. php and try to keep all the logic in the bootstrap class created in your application directory. The next step in setting up ZF 2. 0 is to create the . htaccess file for handling and redirecting all the requests to bootstrap. Create . htaccess file for your project The main function of . htaccess file is redirect all the requests made in the project to the public bootstrap file. Before creating the file, you need to mention its global configuration like rewriting writes and similar permissions.You can do it by following method. Create a directive in your vhost fi le and provide permission for . htaccess to be parsed. allow override all none Now create public/. htaccess file with following code: Once you have created the . htaccess file for your application, you are ready to start with the project. Although there are some simple steps left in the process including setting up the application. ini file and then you can start with creating your first controller, how to input data from user, filter the data, validating data, and a lot of different things.Conclusion: ZF 2. 0 has a lot of quality upgrades as compared to the earlier version and the best way to use all of these features is to follow this guide step by step. There are many new features added in ZF 2. 0 which makes it a really powerful tool for developing impressive web applications. One of the most important additions is the advanced Event Manager and Cloud Infrastructure tool provided in ZF 2. 0. There is a lot to learn in this new feature packed Framework. Next Post Contents: â⬠¢ â⬠¢ Displaying information to user How to link pages together
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.