Beginning Zend Framework - php

I've read a couple of Related questions by the site, but can't find what I'm looking for.
After having done normal PHP without much extra(by which I mean a templating system) for a year now, I feel like trying Zend. Simply because it's the biggest name. I wanna try CakePHP too later.
I've been looking into the examples, but these are all inline-code examples.
In learning PHP, I've used a template system, in order to keep the PHP and the HTML completely separated. Is this possible with the Zend Framework, or should I use a template system alongside it?
Also, what's the deal with executing several .bat files? Is there really so much work in setting up folder-structures with the correct files in them should you did it manually?

Zend Framework is a quite good solution to use as separate modules or complete package as well. You can use only it's templater system (but it's not so super) or you can put on a whole system using Zend_Application, Zend_Controller, Zend_Db, Zend_View, etc.
The .bat (or .sh) file is for the Zend_Tool. It's an experimental command line tool to build modules and applications easier.

I guess you can use zend's built in template solution that comes with Zend View, roll your own, or even integrate something like Smarty. At the end of day, its your call. Zend is fairly flexible in terms of which of its component you want to use and which you don't.

frankly for me these components do the most of work and i dont think i will need more than
(Zend_view , Zend layout , Zend navigation ,Zend breadcrumb)
it's most likely to keep the PHP and the HTML completely separated
about zend tool : its just tool to make Zend development much easier

I highly recommend you take a look at the online tutorial found here. It's a step by step walk through the framework showing you the basics of how you'd build a small Zend Framework app, and shows you how to integrate things like access control, interface with the database, etc. It's written in really understandable language with great source code included.
As for the batch files, you may want to download a demo copy of Zend Studio. It allows you to create a ZF project and does all of the setup for you without requiring you to mess with the command line.
Good luck!

I highly recommend you must first understand the basic directory tree of Zend Framework including all setup needed and familiarization with bootstrapping and setting configurations with a .ini file.

Related

Zend mail code in my php code?

I've got some php code handling emails (not self written) which I want to integrate in my own self written system. In it, two Classes are used:
Zend_Mail_Storage_Pop3($params)
Zend_Mail_Storage_Imap($params)
I've heard of Zend before, but as far as I know it is some kind of full fledged php framework, not something I really what to incorporate in my system just to be able to use these two classes. So I downloaded Zend from the github page, but I can't even find those classes in there.
So my questions are:
Am I able (and if so, how?) to just use these two classes from Zend?
If not, is there an alternative to these two classes which are preferably very easy to use?
All tips are welcome!
It's hard to answer this question without knowing exactly what you want to do (you've just said what classes you think might achieve that goal), but hopefully I can point you in the right direction.
Zend Framework is a full PHP framework, but it was built as a collection of libraries, and to a certain extent you can just cherry pick individual components and only use those. The two classes you listed were from Zend Framework 1. What you downloaded from Github was Zend Framework 2, which is why you can't find them, but ZF2 does have equivalents.
Although you could download ZF1 and get your existing code to work, what I'd suggest you do instead is add just the ZF2 Mail component to your app using Composer. Then start here: http://framework.zend.com/manual/2.3/en/modules/zend.mail.read.html for the docs for the equivalent classes for what I'm guessing you're trying to do.

May I use zend framework together with php files not using it

I am now working in a team to build a website using php. Told that Zend framework can be fairly convenient, I hope to use it to write the pages. However, some of the members in the team did not use the framework in their previous works. I do not know whether there will be any possible problems if their works are used together with mine? So I wonder whether it is possible for us to use Zend frameworks for part of the website while other members of the team do not use this framework to build the rest of the website? Thank you.
i not really sure to undersand your question
but it's look complicated to use ZF for a part of the site, and PHP for the other. However, it's possible. You can, with a .htaccess say that an URL is not define by ZF (i ever used it for a blog attached on a ZF site)
Don't hesitate to comment for any other answer
It depends on how you are splitting up the work. Zend Framework is modular so you are not tied into using the whole framework. You can just select the components you need. I would advise that you use one framework for your application startup and routing at least. Merging these part would be a hassle to maintain imo.

Do I have to convert my PHP app into MVC in order to use Zend_search_lucene?

I have finished writing my own web application now. It is written in PHP with MYSQL DB and I did not use any MVC framework at all. Now I want to add a local search functionality for my app and from looking at the other posts here, Zend_Search_Lucene seems to be a good option for me.
Now if I want to use Zend_Search_Lucene do I have to install the whole Zend framework then re-write my app and adapt them into its MVC framework ?
I am looking to use just the search feature of the framework, and right now I probably do not really mind installing the whole framework, but I surely do if I have to make large-scale changes to my app..
appreciate any answer-suggestion, thx
You can just use the Zend_Search_Lucene package, you don't need to use the whole framework and/or MVC aspect of it. If you don't want to install the whole framework, you have to check package dependencies that Zend_Search_Lucene has. There are some automatic ways of doing this, here are some:
ZF dependency manager
Zend Framework Automatic Dependency Tracking
If you google it you'll sure find more.
For the answer to the question: no, you won't have to change it, you may use Zend Framework libraries independently.
I won't give you any tutorials on Lucene, though.

How to independently use single Zend Framework component like XML-RPC or REST?

Zend framework is well known for loosely coupled components.
I would like to use XML-RPC from zend framework, is there any dependency for XML-RPC? Like if I had taken out XML-RPC folder off Zend Framework Library and try to instantiate RPC object, would it throw error?
Where can I find the proper way of separating component from the framework?
Thanks
I wrote a tool which takes ZF components and their dependencies so you can easily take just one (or several) component from ZF.
http://epic.codeutopia.net/pack/
It doesn't have the latest ZF release 1.11 (because I'm lazy), but 1.10.6 should work just fine.
You should never split single components off a framework or library independent from Zend Framework, or any other. Especially when using PHP there is also no performance reason, because with PHPs autoloading functionality it will always just include the files, which are requested.
You should literally be able to copy the XmlRpc folder from your copy of Zend Framework and use it in your own projects. The only dependency that I can see is in XmlRpc/Exception.php as it requires a file in the root directory of Zend/ (Exception.php) you could simply copy this file along with the XmlRpc folder keeping the directory structure the same and it should work....
My first question is why you would want to do that in the first place. It means that every time you upgrade Zend Framework you now need add a bunch of tooling to manage the removal of some components. One of the purposes of using a framework is so you don't have to manage a bunch of code. Removing parts of a framework is a step backwards IMHO. Disk space is cheap. Network transfer is cheap. If you are going to remove parts of a framework you should have a REALLY, REALLY good reason to do it.

Others frameworks like PEAR

Do you know others frameworks like PEAR (http://pear.php.net) ? I want to use reusable PHP components without using the famous PEAR.
I already use a framework (Zend Framework) and i want to use php components who doesn't exists in ZF like payment, encryption, math...
Check out EZ Components. It is a very loosly coupled set of libraries that I always see as sitting somewhere between something like PEAR and Zend Framework. Superbly coded and up to date, it is something to take a close look at.
I don't really do that much php, but I've worked along side php developers for some time and I've heard comparisons between PEAR, SMARTY and Zend Framework all the time. I can't really tell you how much alike they are, but these are the ones I've heard about the most. I've also heard some saying they work with Cake PHP or Symfony, but not as many.
I also found two nice comparisons that might help, here and here. That's about all the help I can be. Good luck. :)
As a Zend Framework fan myself I don't see why you don't extend Zend Framework based to your needs. I use a rather simple method by having a classes folder inside my application folder which you need to set up in bootstrap or load with Zend_Loader and there you can define your own logic or import different modules you're interested in ( phpClasses might be also very helpful).
You also can find a lot of helpers made by Zend Framework's community which might be helpful at any given time. If you like to go and strip off pieces of code from different sources you might also want to try to import some of the modules from other frameworks like Code Igniter or CakePhp into Zend Framework and that probably would be a fun and useful thing for you and if you'd like to share, maybe for all the community based around ZF
And I should warn you about Symfony (that evilpenguin wrote about), if you're willing to try it just don't forget it's the "laziest" of them all.

Categories