Zend Framework and fuelphp - zend-framework

I wanted to know if it was possible to use zend framework libraries from zend 1.11 in fuelphp? fuel looks nice and I started looking at it as I believe its the next logical step for any CI developer.
Is there any site or a howto for using zend library with fuel?
Thanks

It really depends on what portions of Zend Framework you want to use. Some parts, e.g. Zend_View are tied into the MVC-part of the framework, but components like Zend_Pdf or Zend_Service_* have only few dependencies and should work fine in other frameworks as well.
What you should do is check out the Reference Manual to see what other components are required by the component you are trying to use. And then put them in a library folder. Alternatively, just put the whole Zend Framework in a folder if you don't mind carrying the dead weight with you.
I've been using ZF-components standalone and found that it's useful to add it to include_path as you would when using ZF as MVC-framework, because some ZF-classes are instantiated dynamically, i.e. not via require_once and that won't work without the folder containing Zend/ being in the include_path.
Finally you have to add the folder to your autoloader, this should be as easy as:
Autoloader::add_namespace('Zend', __DIR__.'/path/to/Zend/library');

Related

Add a web page to a site built in Zend Framework

I am a sort-of newbie with MVC and Zend in particular. I have taken over a project from another team, site is built in Zend framework. There is an admin dashboard to add content, assets like images and media, a blog and a portal into Zen Cart for the store.
What is the easiest method of adding a new web page that has as its contents several things that are dynamic - items for sale, music to listen to, blog entries, news items from the database and a featured artist. All of this is stored in the MySQL db. I just do not know enough about MVC to make it work correctly.
I can create a page in the admin dashboard and use as the URL another "module" that already exists, but if I attempt to copy a module folder (for instance the folder called musiclive is almost exactly what I need except I need to add another column of elements...) the admin dashboard does not render. I know that I need to create some sort of "view" and fiddle with or create a controller, but not sure of the easiest method of doing this. I probably have to tell the admin dashboard I have added another "module" but it really is just the main or home page of the site - the other guys never built it because it was rich with details and I guess they put it off. I also probably have to change the files inside the module folder to reflect a different page.
Would love some help or pointers. Ask if you need more details on what the heck I am describing here...
Create a new controller in that same module instead of copying the whole module if the module is so similar to your requirements. And then extend already built resources like forms, models. I strongly recommend you to read about zend framework documentation, especially skeleton application tutorial. That will increase your knowledge as well as make you understand MVC and your current project.
http://framework.zend.com/learn/
One more thing there are 2 versions of zend framework and both are entirely different. You need to know the version in which the project is built. Zend framework 2 has following generic directory structure:
config/
autoload/
application.config.php
module
Application/
config/
src/
view
Module.php
SomeOtherModule/
...
public/
vendor/

Symfony 2 base services configuration

We are starting to use Symfony 2 in our system, not as a whole but by pulling the components we need and kinda build our framework upon it. We have learned that from these articles
http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1
And from learning how Silex works as well.
I'm trying to find out how Symfony framework/standard package defines all the kernel.* services but I cannot seem to find that anywhere even after searching all files. Please give me a point if you know.
Symfony2 framework loads bundles from app/AppKernel.php and defines global services in vendor/symfony/src/Bundle/FrameworkBundle/Resources/config/*.xml

Integrate custom annotations in Zend Framework and Doctrine project

I need some advices or experiences in integrating custom annotations for Doctrine generated entities, but I also want to keep native Doctrine annotations so that they can be somehow registered together.
I have succesfully integrated Doctrine in my ZF application and tested it.
Now I want to have some validations inside my entites. I don't want to write any code in my entities or modify setters. I googled for suggestions and there are some libraries that do the job. Those libraries also provide the ability to return Doctrine entities objects as array (toArray()).
I tried to integrate one of those called Spiffy Library (https://github.com/SpiffyJr/Spiffy). Homepage http://www.spiffyjr.me/.
I followed instructions on that page to include it in my project but no luck. Any help on these would be so appreciated.
Guess I didn't setup correctly AnnotationReader. However I did AnnotationRegistry-ed some of files from Spiffy library (spiffy\Doctrine\Annotations\Validators).
Also gave Spiffy Abstract library my entity manager from ZF registry.
I can also paste some of my code here if neccessary.
Thnaks in advance.

How can I keep just the required files in zend framework for my application?

I'm not sure where to ask this, but frankly I'm using some libraries from the zend framework but at this moment have the entire framework in my library folder. Is there any script or exe out there which go through the application and tell which files are not being used and which are. Theres loads of includes and easy loading going on there.
The files that are included via require_once in the Zend Framework code are mostly required only if they are used.
But if you want to be 100% sure that only the really used ones are loaded (on the fly), use the autoloader in combination with a script that strips all the require_once, as shown in the "Class Loading" part the official performance guide. There is a "How can I eliminate unnecessary require_once statements?" section. And this is a well know ZF optimisation technique, so it should be done anyway.

How to prune Zend Framework?

I wouldn't use most of the classes from Zend Framework, that's why I'm looking for the thinnest possible ZF configuration.
Is there a better way of finding what I really need other than deleting the whole library/Zend folder, then putting back files based on the error messages that I receive?
I have not used it myself, but http://blog.fedecarg.com/2009/02/01/zend-framework-automatic-dependency-tracking/ may be what you are looking for.
Hm...
There is a lot of information about Zend Framework on SO and with a little bit of reading you would have found the answers to your question
You would also find the answers to your question by just reading the introduction to Zend Framework on the Zend Framework website.
No, that's not how you'll do it. Zend Framework, unlike most/all other PHP frameworks, is rigidly loosely coupled. You can use every component stand-alone. You can only use the loader, or only Zend_Translate. Or you can just use the MVC modules, or Zend_Db, etc.
Of course if you use Zend_Form and want to validate or filter the input, you'll need Zend_Validate and Zend_Filter. But you'll know that because you'll instantiate objects. So just copy into your empty library folder the modules you need. Or even better, copy everything in! A) you won't regret it. B) disk space is not your problem.
What I would do is set up the plugin loader cache and then purge all files apart from the ones called within the automatically generated include file.
zend.loader.pluginloader.performance
I hope it makes sense... :o)