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.
Related
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.
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.
I am trying to setup the "Merchant SDK" for Express Checkout option with Paypal.
While installing the 'dependecy' as prescribed with curl or composer, the system is having trouble with loading 'sqlsrv' and some other modules.
My doubt : Is this all really necessary? Can't I just download the SDK files from github and start using them? The only dependency needed for the basic working is openssl. Am I right about it? What is it that curl/composer really do in this case?
curl is utility to transfer data with different protocols and composer is a php dependency manager which helps in deployment of php code and makes sure that you have the required libraries. You can surely use the code directly but it might become difficult to maintain it.
If you're going to use their SDK it's recommended that you use composer to install their package. That's the only way you'll be able to follow along nicely with all their samples/tutorials.
curl is going to be required to make POST calls to PayPal, but it's generally enabled by default on any good web host. The composer file is just ensuring that it is available when it installs the package. The way they built their SDK's does make it a little tough to use without following those procedures.
If you want something a little more direct you might be interested in my PHP class library for PayPal. It requires curl, too, but again you should already have that, and it comes complete with functional samples and prepared template files for all of the API calls PayPal provides. You can take care of pretty much any API call you need in a matter of minutes.
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
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