How to check Zend_Http_Client is available on server - php

Sorry I'm not familiar with php and I have to send something via Zend_Http_Client. How I can check that feature is available on server, because at the moment I've only got error 500.

You need to check if ZF is available in your project libraries.
For Ubuntu, ZF should be in one of those:
/usr/share/zend/
/usr/share/php/
/usr/local/zend/
or in your project directory.
In ZF "Zend_Http_Client", means that in your library directory you should have this folder structure: (...)/Zend/Http/Client/

Zend_Http_Client is not a "feature", but a class from the Zend Framework library. In short is a set of classes that you can use as a whole or in parts to help you speed the development of your project. It offers solutions in a lot of common scenarios, and Zend_Http_Client is actually part of an interface that will help you work with HTTP requests.
Check the requirements for it here and how to install it here. The most common way is to add the library to the PHP include_path or to add it via composer to your project.

Related

Add Behat\Symfony2Extension support to my behat suite

I have a central Behat test suite codebase I use all throughout my companies projects. There is a ApiContext available which does curl calls using the curl lib from PHP itself but I really want to start supporting the Behat\Symfony2Extension in our Symfony projects as well so I don't have to setup nginx to listen to create a vhost to call those curl calls to.
I am a Symfony n00b and I'm not sure how to do this. I've setup the extension but the problem here (I think) is the use of curl in this case.
Maybe someone of you could help me get an idea of what I can do to fix this. I still want to support this lib with external calls as it is used in other projects too.

Manual install for PHP API library for Elasticsearch

I downloaded this php api package from github
https://github.com/elastic/elasticsearch-php/tree/2.0
but I am having a hard time installing it. I unfortunately dont have permission to use the composer/auto-loader from where I work so I have to do it manually. Is there a way of doing this?
Thanks for your help.
The classes look pretty well formatted PSR-4 so you should be able to just download the directorysrc/Elasticsearch, and make a simple autoloader of your own and register it (assuming you don't already have one setup to serve classes that adhere to PSR-4).
Here's some options: http://www.php-fig.org/psr/psr-4/examples/
All the other directories seem to to be extraneous to running of the classes--for unit testing and benchmarking.

Restler API framework installation

I want to start using Restler to develop a Rest api but, I couldn't find any detail information on how to install it, besides, it seems to run on a nginx server.
Is there a way to run this framework on apache? Are there other alternatives for building high quality APIS? Is there a detail documentation about installing this framework?
I must be able to run this framework on apache and using php5.3
Thanks
you have to enable apache mod_rewrite
I'm running restler (somewhat modified) for an API (api.hostingxs.nl). It works fine on apache with PHP 5.3. Just clone the repository from github (git clone https://github.com/Luracast/Restler.git <yourdirectory>) and start including classes that use it (read the manual).
If you need more directions I can post some sample code, but the basic functionality is really easy if you understand Object Oriented PHP.
First off, redirect all requests to your restler domain, folder to the index.php and create that file with something like this:
require_once( "restler.php" ); # or whatever you need to link to
$r = new Restler;
$r -> handle();
# above is the basic functionality without any of your own things
Click on the classes in the following link to read more about setting up your own classes; help.luracast.com/restler/examples/_002_minimal/readme.html
If you're wanting to create a RESTful API, then I created a lightweight framework for exactly that: https://github.com/martinbean/api-framework

Zend framework installation - need clarification

I've seen lots of videos and instructions on how to install zend framework on wamp and other similiar local host environments. I've also seen lots of references, including here, that mention you don't need to 'install' zend, it just needs to be included in the php files to work.
As I think I understand it, installing zend on localhost environments will allow you to utilize certain tools that for example automate the creation of projects and gets the most out of the framework. I'm assuming that to then use these projects in a web host environment, you simply need to upload a specific project's files and ensure the zend files are in place and included in the directories.
Are my assumptions correct? I'm still trying to grasp the basics of this one and haven't found clarifications in my google searches.
Everything you wrote is correct. It helped me to think of Zend Framework as a library of components rather than as a program you need to install. As long as your application has access to that library of components, Zend Framework is installed. This doesn't address any of the configuration tasks you'll need in Bootstrap and/or application.ini, but should clear up installation.
Regarding the automated creation of projects and project elements (controllers, actions, etc.) this feature is available via Zend_Tool and is typically used only during development, so it shouldn't come into play once you've ported from your localhost.
Automated creation of the projects is far not the main feature of Zend.
The majority of the php frameworks are about providing the best infrastructure for complying to MVC design pattern, about object relational mapping, security enhancements etc.
And yes, the whole project tree is what you'd need to carry around for deployments.

How do you handle library dependencies during deployment using PHP?

this is a question on PHP mainly. I was wondering: How do you make sure that all necessary libaries are packaged with your application when you do a deployment to (production) servers?
A more concrete example: I have an app running on Zend Framework and each time I roll the application to a server the deployment process creates a fresh "installation" on that system. Therefore, I need to bundle Zend Framework together with my application and then copy the files to the right places together (it is done automatically). Currently, I am using a svn:externals definition to get the files out of Zend's SVN system during deployment, however, I don't want to rely on that SVN and I also don't want to put traffic on external SVNs with each deployment.
In the Java world, I am used to Maven which handles such stuff using central artifact repositries. I know that there is a Maven4PHP version, however, I am more looking for a PHP-based solution. Additionally, I don't believe that PEAR is a good way to go as it doesn't really fulfill my requirement of bundling the applicaiton (incl. libs) into a single deployable.
Is there some tool available already that I am not aware? Or do you have any great technique that I should know?
Thanks much for your help!
Michael
There's a build system called Phing which is written in PHP and based on Apache Ant.
I personally can very well live with externals.
I think the vendor branching would solve the problem from your example quite straightforward, but if you also don't like large repositories I'd recommended to keep watching on the modern toys like composer and what it solve(and maybe phark, I never heard before :) )
It isn't production ready yet but you might want to keep an eye on the Phark project. It is a port of Bundler to PHP.
While looking through the Simplify your external dependency management slides I came across a tool called pantr which can be used as a PEAR installer. pantr as PEAR installer which allows you to specify your dependencies in a project specific file.
The article Version Control != Dependency Management has some information about using the new PEAR installer called Pyrus

Categories