News Feed
Sections




News Archive
feed this:

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

Chris Hartjes:
Data Providers and Arrays
October 28, 2013 @ 11:49:36

Chris Hartjes, testing guru, has a post talking about using arrays in data providers for your unit tests. More specifically about some odd behavior one developer was seeing in their tests.

I was asked a question on Twitter by Tex Morgan about a problem he was having with PHPUnit data providers. He was trying to pass in some data and kept wondering why PHPUnit was serializing the data instead of doing what he was expecting.

The issue (example code included) was in how the data providers are expecting the data to be returned. His test was expecting an array but the data provider was returning things incorrectly. As Chris points out, the provider should return an array of arrays. The fix is easy, but could be confusing to someone not used to this slightly unusual return format.

0 comments voice your opinion now!
data provider unittest array return value example

Link: http://www.littlehart.net/atthekeyboard/2013/10/26/data-providers-and-arrays/

The PHP.cc:
PHP 5.5 Generators
July 10, 2013 @ 11:49:04

In this latest post to The PHP.cc's blog, Sebastian Bergmann talks about using a new feature in PHP - generators.

A generator is an interruptible function that returns a sequence of values (using the yield keyword) instead of a single value (using the return keyword). Two things happen when the yield statement of a generator function is executed: the argument of the yield statement is yielded and the execution of the generator function is suspended. The execution of the generator function is resumed when the next value is requested.

He starts with a simple example, showing a basic foreach loop calling a generator to produce (yield) an incrementing number each time. He also provides a more "real world" use case - using generators as data providers for PHPUnit tests. His example generates a new "Address" object each time the provider is called with a bit of "randomized" information included.

0 comments voice your opinion now!
generators introduction phpunit data provider tutorial

Link: http://thephp.cc/viewpoints/blog/2013/07/php-5-5-generators

Gonzalo Ayuso:
Working with jQuery and Silex as RestFull Resource provider
June 10, 2013 @ 12:40:01

In a previous post Gonzalo Ayuso showed how to use Silex as a data provider to an AngularJS application REST-fully. In this new post he does the same thing but with jQuery this time.

The previous post was about how to use AngularJS resources with Silex. AngularJS is great and when I need to switch back to jQuery it looks like I go back 10 years in web development, but business is business and I need to live with jQuery too. Because of that this post is about how to use the Silex RestFull resources from the previous post, now with jQuery.

He includes the sample code showing the jQuery version of the application based on a "Resource" object. He also includes some samples of its use for the usual CRUD operations. You can get the full code from github.

0 comments voice your opinion now!
jquery rest tutorial resource silex provider

Link: http://gonzalo123.com/2013/06/10/working-with-jquery-and-silex-as-restfull-resource-provider

Gonzalo Ayuso:
Google App Engine, PHP and Silex. Setting up a Login Provider
May 21, 2013 @ 10:41:07

Gonzalo Ayuso has a new post to his site today showing how to use the recently released PHP support for the Google App Engine along with Silex to create a login provider.

Last week Google announced the PHP support for Google App Engine (GAE). PHPStorm, the great IDE for PHP development, also announced support for Google App Engine PHP. Because of that now is time to hack a little bit with this new toy. [...] To build a simple Silex application over Google App Engine is pretty straightforward (more info here). Because of that we're going to go a little further. We are going to use the log-in framework provided by GAE to log-in with our Goggle account within our Silex application. In fact we can use the standard OAuth authentication process but Google provides a simple way to use our gmail account.

He includes the code showing what the end result will look like as well as what's needed for the "LoginProvider" class. He also creates an "Auth" class where most of the work is done - creating the login URL, redirecting the user and checking to see if the user is logged in. He's made a screencast of the full process so you can see the authentication flow as its happening.

0 comments voice your opinion now!
silex google appengine login provider

Link: http://gonzalo123.com/2013/05/20/google-app-engine-php-and-silex-setting-up-a-login-provider

PHPMaster.com:
Simplifying Test Data Generation with Faker
February 19, 2013 @ 12:09:02

In a new post to PHPMaster.com today, Rakhitha Nimesh takes a look at Faker, a tool that can be used to generate random test case data as a part of your workflow.

Testing is an iterative part of the development process that we carry out to ensure the quality of our code. A large portion of this entails writing test cases and testing each unit of our application using random test data. Actual data for our application comes in when we release it to production, but during the development process we need fake data similar to real data for testing purposes. The popular open source library Faker provides us with the ability to generate different data suitable for a wide range of scenarios.

Faker uses built-in data providers like "Person", "Company", "DateTime" and "UserAgent" to give you randomized output from the data sets you define. Code is included showing how to create the provider in your objects, extending the correct provider and making a request for a property. A real-world example is also included about testing an email marketing engine for address, title, name and content. There's also a little bit added at the end showing how you can increase the randomness of the results returned by "seeding" the Faker engine.

0 comments voice your opinion now!
test data generation faker library object provider tutorial


Oracle.com:
Oracle Invests in Leading Platform-as-a-Service Company Engine Yard
November 14, 2012 @ 12:19:35

According to a new press release on the Oracle.com site today, they've announced the company's investment in the popular PaaS provider (and big sponsor of several PHP conferences, events and the community) Engine Yard. From the official press release:

Oracle announced today that it has made a strategic minority investment in Engine Yard, a leading cloud development platform that supports Ruby, PHP and Node.js, popular web development languages. [...] In conjunction with this investment, Oracle and Engine Yard expect to work closely together to provide cloud application developers with a greater choice of development and deployment options. The two companies are expected to connect their respective PaaS offerings to enable more rapid development of applications in a secure, reliable and scalable environment.

No word yet on how this will integrate with Oracle's own cloud solutions but it should be interesting to see what comes out of it. Congratulations to the Engine Yard folks on the investment!

0 comments voice your opinion now!
oracle engineyard orchestra paas provider cloud pressrelease


Fortrabbit.com:
Cloudscapes - Comparing PHP Cloud Hosting Platforms
July 11, 2012 @ 11:27:07

On the Fortrabbit.com blog there's a new post that does a quick overview and comparison of 11 of the more popular cloud-based hosting platforms out there that are PHP friendly.

We are currently building yet another PHP Cloud Platform ourselves. Of course we looked around to see what the others are up to. This is my (Franks) personal point of view of the current market situation showcasing my favorite services. I try not to judge, neither i will compare features nor prices.

Services on his list include:

0 comments voice your opinion now!
cloudscapes cloud hosting provider evaluation


Hasin Hayder's Blog:
Developing PHP applications in the cloud with free cloud hosting providers
October 25, 2011 @ 09:42:33

Hasin Hayder has put together a list of cloud hosting providers that are already set and ready to go for PHP applications. His list highlights a few of the free ones.

I will be focusing on some of these free cloud hosting options available out there. One thing to note before you proceed - these free cloud hosting options are very good to develop and test your applications (in dev+staging environment) and it may not be wise to deploy the production version of your application with any free plan (Except Amazon AWS's free tier, its production ready).

He has four different services on his list, ranging anywhere from small to industrial strength, depending on your needs:

0 comments voice your opinion now!
cloud hosting provider application host


Lorna Mitchell' Blog:
PHP OAuth Provider Access Tokens
August 30, 2011 @ 08:28:04

Lorna Mitchell has posted the latest in her look at OAuth in PHP to her blog today, an introduction to access tokens - generating and handling them in your application.

I've been working with OAuth, as a provider and consumer, and there isn't a lot of documentation around it for PHP at the moment so I thought I'd share my experience in this series of articles. [...] This entry follows on from the ones about the initial requirements, how to how to handle request tokens, and authenticating users.

In this latest post, she talks about the three different types of tokens - consumer, request and verififier - and how to use them to locate a user in your app's users. Her code validates the request token and verifier against the database and, if successful, inserts the rest of the token information for the user.

0 comments voice your opinion now!
oauth provider tutorial access token consumer secret verifier


Stas Malyshev's Blog:
ZF Oauth Provider
August 29, 2011 @ 10:41:18

In a new post Stas Malyshev has shared some code for an OAuth provider he's written up to work specifically with Zend Framework applications.

Zend Framework has pretty good OAuth consumer implementation. However, it has no support for implementing OAuth provider, and it turns out that there aren't many other libraries for it. Most examples out there base on PECL oauth extension, which works just fine, with one caveat - you have to have this PECL extension installed, while ZF implementation does not require that. So I went ahead and wrote some code that allows to easily add OAuth provider to your ZF-based or ZF-using application. That should make writing OAuth provider easier.

His code just fleshes out the server portion of the provider, not all of the token generation and key handling it'll need on the backend - that'll still be the job of your scripts. You can find the library over on github in his Zend_OAuth_Provider repository.

0 comments voice your opinion now!
zendframework oauth provider framework server frontend key token



Community Events





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


list laravel release podcast series bugfix api deployment framework language introduction community developer library symfony voicesoftheelephpant tips zendserver conference interview

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