News Feed
Jobs Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

AWS PHP Development:
Testing Webhooks Locally for Amazon SNS
April 08, 2014 @ 11:33:07

In a previous post the AWS for PHP blog showed how to set up webhooks for handling the callbacks from their SNS messaging service. In this next part of the series they continue the process, showing how you can test these hooks locally without needing to actually send the messages. This eliminates the need to deploy to a public-facing server just to test the hooks every time you need an update.

In a recent post, I talked about Receiving Amazon SNS Messages in PHP. I showed you how to use the SNS Message and MessageValidator classes in the AWS SDK for PHP to handle incoming SNS messages. The PHP code for the webhook is easy to write, but can be difficult to test properly, since it must be deployed to a server in order to be accessible to Amazon SNS. I'll show you how you can actually test your code locally with the help of a few simple tools.

Using PHP's own built-in webserver and a tool called ngrok to tunnel from the public internet to a local server. He includes the commands to set up the PHP script directory, the code to intercept the POSTed data from the request, validate it and send the subscription confirmation request. He helps you create an SNS "topic" through the management console and walks you through a sample test request while tailing the logs.

0 comments voice your opinion now!
aws amazon sns webhook testing local server ngrok tutorial

Link: http://blogs.aws.amazon.com/php/post/Tx2CO24DVG9CAK0/Testing-Webhooks-Locally-for-Amazon-SNS

SitePoint PHP Blog:
Piping Emails to a Laravel Application
February 17, 2014 @ 09:13:48

On the SitePoint PHP blog there's a new tutorial posted about piping emails to Laravel (well, a Laravel-based application). He shows how to have your application take data in from the current input, parse it and insert the data into a database.

In project management or support management tools, you will see this a lot: you can reply to an email message and it is automatically visible in a web application. Somehow, these tools were able to get those email messages right into their system. In this article, we are going to have a look at how we can pipe emails to our Laravel 4 application.

He walks you through the creation of an Artisan command, "email.parse", and using the PHP MIME Mail Parser library to extract data. He gets the to, from, title and message contents from the email and shows how to work with attachments too. Finally, he shows how to set up the mail server to pipe the incoming email though the PHP script for parsing.

0 comments voice your opinion now!
email parse message laravel tutorial mail server

Link: http://www.sitepoint.com/piping-emails-laravel-application/

Gonzalo Ayuso:
How to run a Web Server from a PHP application
November 11, 2013 @ 11:53:06

Gonzalo Ayuso has put together a post showing how (by implementing the Reactor design pattern) he created a simple web server inside a PHP application. It combines a few Symfony2 components and the React library to build a simple server in a bit more programatic way.

Normally we deploy our PHP applications in a webserver (such as apache, nginx, ). I used to have one apache webserver in my personal computer to play with my applications, but from time to now I prefer to use PHP's built-in webserver for my experiments. It's really simple. [...] With PHP we cannot do it. Sure? That assertion isn't really true. We can do it. I've just create one small library to do it in two different ways. First running the built-in web server and also running one React web server.

The idea is that all that would be needed is a stand-alone PHP script that could be run anywhere and start up its own web server, no other software required. He includes a simplified version of the example, showing how to make servers with both React and PHP's own server. He also includes an example of a basic Silex application that uses it as well as some benchmarks (with Apache ab) for each of the implementations and their request/response times on average for simple and Silex requests.

0 comments voice your opinion now!
builtin webserver server example react silex

Link: http://gonzalo123.com/2013/11/11/how-to-run-a-web-server-from-a-php-application/

Zend:
Apigility Progress report zf-mvc-auth, packagist, and PHP's built-in web server
November 01, 2013 @ 15:52:11

In a new post to the Apigility forums today Matthew Weier O'Phinney has announced the release of an authentication/authorization component for the recently announced project from Zend. Apigility is a Zend Framework-based tool for easily constructing and managing an API.

We've been working hard on Apigility since ZendCon, and have released some more code into the wild. zf-mvc-auth exists to provide both authentication and authorization for your APIs; in fact, it's a bit of a general-purpose library for ZF2 MVC apps! Right now, we support HTTP basic and digest authentication out of the box, and will be working next on OAuth support. Authorization is done by default via ZendPermissionsAcl, as we discovered a problem with using RBAC: RBAC is deny-by-default, which does not work when you want an open-by-default schema. You may opt-in to deny-by-default, as well as mark individual services as requiring permission by default. Finally, you have the option of denying/allowing per HTTP method of a service as well.

You can find out more details about this functionality in this quick screencast. The zf-apgility module depends on this new zf-mvc-auth module, so it will be included and available by default in your APIs. In that same post Matthew also talks about the listing of the Apigility packages on Packagist service and a note for those wanting to use the built-in HTTP server to run the tool (a PHP version dependency).

0 comments voice your opinion now!
apigility progress zendframework mvc authentication authorization packagist http server

Link: https://groups.google.com/a/zend.com/forum/#!topic/apigility-users/_mOPkxxmGYI

Gonzalo Ayuso:
Playing with event dispatcher and Silex. Sending logs to a remote server.
October 22, 2013 @ 09:44:57

Gonzalo Ayuso as a new post today showing the results of some of his testing with the event dispatcher and Silex to send logs to a remote server.

Today I continue playing with event dispatcher and Silex. Now I want to send a detailed log of our Kernel events to a remote server. We can do it something similar with Monolog, but I want to implement one working example hacking a little bit the event dispatcher. Basically we're going to create one Logger class (implementing PSR-3 of course).

He includes the sample code defining a "Logger" class that takes whatever message sent to it and pushes it into a given socket resource. He also creates a provider for the logger to implement it in the example and registers it with the event dispatcher. He hooks it into the request, get controller, terminate and exception events. On the other side he uses React to make a basic server to listen on port 4000 for the incoming log data.

0 comments voice your opinion now!
silex event dispatcher remote server log logger psr3

Link: http://gonzalo123.com/2013/10/21/playing-with-event-dispatcher-and-silex-sending-logs-to-a-remote-server/

Kevin Schroder:
What SSL $_SERVER variables are available in PHP
September 02, 2013 @ 09:24:04

Kevin Schroeder has shared the results of a question he wanted answered when it came to PHP with a HTTPS (SSL) connection - which of the $_SERVER variables are available.

I found myself wondering what HTTPS variables were available in the $_SERVER variable today and didn't find a specific list (and didn't have mod_ssl installed). So as a public service, here is what my server says.

Thanks to some of the additional handling and information the SSL connection provides to PHP, there's several additional variables including things like:

  • SSL_PROTOCOL
  • HTTPS (set to "on")
  • SSL_COMPRESS_METHOD
  • SSL_CLIENT_VERIFY
0 comments voice your opinion now!
ssl server superglobal variable

Link: http://www.eschrade.com/page/what-ssl-_server-variables-are-available-in-php/

BinaryTides.com:
Setup Nginx + php-FPM + apc + MariaDB on Debian 7 - The perfect LEMP server
August 09, 2013 @ 11:58:39

On the BinaryTides.com site today there's a tutorial they've posted walking you through the full install process to get Nginx, PHP-FPM (with APC) and MariaDb working together on Debian, complete with configuration changes and all the commands you'll need.

Debian is a great choice for setting up linux webservers. According to current stats it is the most popular server OS followed closely by centos. I am a great fan of the apt/dpkg/gdebi commands, which make it so easy to install and update packages on the system. To setup a complete functional php webserver, you need to install a couple of extra things which include a webserver and a database. In this post we shall be setting up nginx, php, php-fpm, apc and maridb.

The tutorial is broken up into three main steps, each with clarification of what's involved:

  • Install Nginx on Debian
  • Install php and php-fpm
  • Install MariaDB on Debian
0 comments voice your opinion now!
lemp server debian phpfpm mariadb apc

Link: http://www.binarytides.com/install-nginx-php-fpm-mariadb-debian

Alvaro Videla:
Using RabbitMQ in Unit Tests
May 01, 2013 @ 09:10:11

Alvaro Videla has a new post today showing how he used RabbitMQ in his unit testing runs with a small, quickly installed version of the server that can be removed once the tests are complete.

In this blog post I want to show you a very simple technique for using RabbitMQ in our Unit or Functional Tests. Let's say you wrote a bunch of tests for your RabbitMQ consumers and then it's time to run them. To do that you probably need to setup a RabbitMQ server just for tests with their own users and passwords, or you need to set up a whole new virtual host for your tests. [...] With a future release of RabbitMQ that we can already test on the nightlies website, we can run RabbitMQ without the need to install Erlang. We created a package that ships a stripped down version of Erlang together with the broker bits, so running RabbitMQ now is as easy as downloading a tarball, uncompressing it and starting the server.

With a combination of this more self-contained package and some listener handling through PHPUnit, they uncompress the tarball with a PHP script and start the server with the defined configuration. Then, once the tests are done, it cleans itself up and removes the entire server directory to make for a clean run the next time.

0 comments voice your opinion now!
rabbitmq standalone server erlang unittest phpunit

Link: http://videlalvaro.github.io/2013/04/using-rabbitmq-in-unit-tests.html

Software Gunslinger:
PHP is meant to die, continued
April 26, 2013 @ 09:15:56

In his previous post ("PHP was meant to die") the point was made that PHP isn't really designed as a language to handle long running processes very well. It's made to handle a few operations and then die at the end of the request. In this follow up post he talks more about using PHP for long running processes and a library that could help.

Yes, I already acknowledged that PHP has a garbage collection implementation starting 5.3.0 and up (opt-in or opt-out, that's not the problem). I also acknowledge that garbage collection works, and is able to take care of most circular references just fine. [...] Anyway, as previously stated too, garbage collection is a great thing, but not enough for PHP. It's a borrowed feature that does not play well with old fundamental decisions inherited from the original design. Garbage collection is not a magical solution for every problem, like many tried to argue about. Let's illustrate with another example.

His example uses the React PHP library (a non-blocking I/O platform) to handle a lot of incoming data to a port and report back some memory usage and limit settings. He explains a bit about what's happening and shares the results of the test, including the end result - a fatal error when the memory limit was hit. He still comes to the same conclusion, ultimately...PHP is just not the language to use for long-running processes that do any large amount of work.

0 comments voice your opinion now!
react die longrunning process testing socket server memory limit

Link: http://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued

Gonzalo Ayuso:
Enqueue Symfony's process components with PHP and ZeroMQ
April 09, 2013 @ 11:11:59

Gonzalo Ayuso has a new post today showing how he set up queuing with ZeroMQ and Symfony components and React.

Today I'd like to play with ZeroMQ. ZeroMQ is a great tool to work with sockets. I will show you the problem that I want to solve: One web application needs to execute background processes but I need to execute those processes in order. Two users cannot execute one process at the same time. OK, if we face to this problem we can use Gearman. I've written various posts about Gearman (here and here for example). But today I want to play with ZeroMQ.

He uses React and some ZeroMQ bindings and Symfony's Process component to make a simple client and server for working with the queue and processes. A screencast is included in the post showing them making the connection and adding the new process. The full code can be found on github (or installable via Composer)

0 comments voice your opinion now!
zeromq symfony component process react server client tutorial

Link: http://gonzalo123.com/2013/04/08/building-a-zeromq-enqueue-with-php


Community Events











Don't see your event here?
Let us know!


overview language framework hack database install performance symfony2 application podcast security opinion unittest package release hhvm facebook composer introduction component

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework