I've downloaded the Zend GData package to use the Google Calendar API. When I look through the contents of the package it seems to contain loads and loads of stuff. Do I really need all of it just for using Google Calendar and no other Google APIs? If not, what can i safely get rid of?
You probably won't use many of the files in Gdata folder, but Zend_Gdata_Calendar extends the Gdata class, and Gdata extends Gdata_App which uses Zend_Http_Client (and a few other classes) to (essentially) make requests to google. Loader loads classes, Registry stores objects/data, and so on. So, yeah, many of the downloaded files will be used. You could of course rewrite much of the code to use only the parts you need, but that kind of defeats the point of using the framework.
I'd recommend building a prototype of your application following the tutorials on Zend but with all the library in place. Once you can see how it works, you can more easily rip what you don't need. At least it's just the Gdata library and not the whole 64MB full framework :D
Related
Originally, I was searching how to use php to retrieve book information from amazon. and I found this question:
How can I use Amazon's API in PHP to search for books?
I think this works, but I am having stupid question. I am not able to install and use Zend Service Amazon. I downloaded the software of around 60 MB but, was corrupted.
May be, I actually want some php files to implement it. but, its giving some kind of exe file.
so, here my question is;
Where do I download Zend framework?
How do I install it?
How do I use it?
Thanks in advance
The official download for Zend Framework can be found here. Since you intend to use ZF more as a library than an MVC application framework, you only really need to download the much smaller minimal package.
From looking at the Amazon files you are interested in, I think the list of the following files are all you would need to copy into your application in order to use the Zend Framework Amazon Service APIs (when I use ZF as a library, I always try to only include the actual files I will be using, rather than the whole package, but for starters you can just copy the entire Zend folder to get going):
Zend/Exception.php
Zend/Loader.php
Zend/Loader/Autoloader.php
Zend/Loader/Exception.php
Zend/Uri.php
Zend/Uri/Exception.php
Zend/Service/Abstract.php
Zend/Service/Amazon.php
Zend/Service/Exception.php
Zend/Service/Amazon/Abstract.php
Zend/Service/Amazon/Accessories.php
Zend/Service/Amazon/Authentication.php
Zend/Service/Amazon/CustomerReview.php
Zend/Service/Amazon/EditorialReview.php
Zend/Service/Amazon/Image.php
Zend/Service/Amazon/Item.php
Zend/Service/Amazon/ListmaniaList.php
Zend/Service/Amazon/Offer.php
Zend/Service/Amazon/OfferSet.php
Zend/Service/Amazon/Query.php
Zend/Service/Amazon/ResultSet.php
Zend/Service/Amazon/SimilarProduct.php
Zend/Rest/Client.php
Zend/Rest/Client/Result.php
Zend/Rest/Client/Result/Exception.php
Zend/Crypt.php
Zend/Crypt/Exception.php
Zend/Crypt/Hmac.php
Zend/Crypt/Hmac/Exception.php
If I missed any, forgive me; you should get an exception saying class not found if I left any out, and that should be pretty straightforward to resolve which additional file(s) you need to include.
In order to use Zend Framework I recommending doing the following:
First and foremost, add Zend Framework's files to your PHP include_path. In order to use the ZF files, you need to preserve the directory structure they use, at the very least, you need a Zend folder with all the ZF files in there.
Add to your include path like this:
set_include_path(get_include_path() . PATH_SEPARATOR . '/zf/folder/path');
zf/folder/path should be the path to the folder that the Zend directory is in, but make sure not to actually include the Zend folder in the include path (since Zend does require_once 'Zend/File.php';
Secondly, set up the autoloader if possible. If you decide to use the Zend Framework autoloader, you won't have to manually 'require_once' many of the ZF files.
To set up their autoloader, all you have to do is get an instance of it:
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
You don't need to save or do anything with $autoloader. Just that call is enough to register the Zend autoloader. Since the ZF files are in your path, it will automatically know how to load and locate all ZF files.
After you perform those steps, you are able to use the Amazon services via Zend Framework in your PHP application.
As for the details of using that, hopefully you can find all the details and help you need here, Zend_Service_Amazon Reference Guide. The reference guide should be your best bet, but you can always find the phpDocumentor class documentation here.
Hope that helps! Feel free to ask if you need clarification on anything.
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.
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.
We are looking to build a PHP web application to manage data that is available only through a 3rd party REST like interface.
We would like to use an existing PHP framework to do this, we're considering cakephp and codeigniter, but are open to other options.
We expect the biggest problem will be creating models that utilise the REST API as a data source instead of a local database.
I've written a base ReST datasource plugin for CakePHP and am using it in lots of other plugins that interact with ReSTful APIs. Plugins I've released so far are YahooGeoPlanet and bit.ly and I'm also currently working on ones for Google Apis (YouTube and Analytics), Twitter, Twitpic and Facebook. They use the CakePHP's excellent HttpSocket class that deceze mentions.
Have a look at those CakePHP plugins and you should be able to see how simple but powerful they are.
You might look at Zend_Rest_Client, which I've never used, but appears worth a look.
Failing that, Zend_Http_Client is pretty solid for abstracting away all the curl ugliness.
Either one can be used independently of the rest of the Zend Framework stuff, and should interoperate just fine with other frameworks.
You can implement it as a Datasource in Cake, which to the Model and therefore to the rest of the application behaves exactly as a database would. Internally the Datasource can dynamically fetch the data using cURL or the Cake HttpSocket. Have a look at the Twitter API example.
I want to include Google Cloud in one of my webprojects which is based on Codeiginiter.
Now my big question is, how to implement the Google API PHP client into CI?
Since CI is a MVC framework it wouldn't make sense including it directly with require_once in the view, so I thought about creating a library but that means a lot of work.
Does anyone know a better solution or maybe a fitting CI library?
Thanks.
This can be implemented by creating a simple library by extending the Google_Api
some thing like..
require_once /path/to/Google_Api/file_name.php
Class my_google_api extend Google_Api
{
// constructor
}
Now load this library to your controller and the access all the methods from Google_api
You can use composer. CI supports autoloading of third party libraries with composer. Besides, usage of composer is a preferred method to install Google APIs Client Library. In this way you won't need to include the library with require_once, all the modules will be loaded automaticly by composer's autoloader.