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

php[architect]:
Functional Programming in PHP Release
September 08, 2014 @ 11:14:22

While not a mainstream practice in the PHP world, functional programming has been a topic that's popped up again and again over the years. If you've ever wondered what it's all about and how to get started with it in your applications, take a look at php[architect].

This book is for anyone that has an interest in functional programming or PHP as an advanced programming language. If you are curious or have never even heard of functional programming before then this is the gentle introductory text you have been looking for. Equally it serves those seeking to exploit the advanced functional concepts such as monads in a PHP context.

This book comes from some of the experience Simon has had with functional programming in the past (and taught about in presentations). It provides examples showing the techniques of functional programming applied in PHP including: map/reduce, currying and composition. The book can be purchased either directly from php[architect] or from Amazon (or Amazon.co.uk).

0 comments voice your opinion now!
functional programming release book phparchitect simonholywell

Link: http://www.functionalphp.com

Three Devs & A Maybe Podcast:
Functional Programming with Simon Holywell
July 23, 2014 @ 11:03:45

Three Devs & A Maybe podcast has released their latest episode today: Episode #35 - an interview with Simon Holywell. Simon is the author of an upcoming book about functional programming in PHP.

This week we are lucky to have Simon Holywell on the show to talk all things Functional Programming. Initially starting off with a concrete definition of Functional Programming, we move on to a brief history of the paradigm and immutability. Following this we explain recursion (and tail-recursion), along with closures and higher-order functions. From this base we are able to then talk about the different languages available to you which cater towards the functional mindset (i.e. Haskell). We then set our sights on the PHP language and what/wish it had to offer when exploring the functional paradigm. Finally, we mention his upcoming book, along with experiences presenting at user-group meet-ups.

Topics mentioned in this episode include:

You can listen to this latest episode either through the in-page player or by downloading the mp3 directly.

0 comments voice your opinion now!
threedevsandamaybe podcast ep35 simonholywell functional php

Link: http://threedevsandamaybe.com/posts/functional-programming-with-simon-holywell/

SitePoint PHP Blog:
Functional Testing in Symfony2
March 04, 2014 @ 11:16:45

Taylor Ren has written up a new tutorial for the SitePoint PHP blog today walking you through a method for functional testing a Symfony application with the help of Symfony's own "WebTestCase" functionality.

In my previous article, we demonstrated how to load sample data into our Symfony development environment. The test data may not be useful as it stands on its own. When coupled with Functional Testing, however, it becomes a life saver. [...] Functional Testing is different. We don't look at the "correctness" of a single function, which should be verified by a Unit Test, but look at the bigger picture. The question answered by Functional Testing is: Is our app performing well in the sense that it displays the right content, corresponds to a user's interaction, etc?

He shows how to create a simple WebTestCase-based test to fetch the main page of a site, locate a few pieces of information and click on a certain link. Once this test passes, he adds a bit more to the test, checking the data in the page following the click.

0 comments voice your opinion now!
symfony2 functional testing tutorial webtestcase

Link: http://www.sitepoint.com/functional-testing-symfony2/

VG Tech:
Generating Code Coverage of Behat Tests
January 22, 2014 @ 10:52:57

On the VGTech blog today Christer Edvartsen looks at a method of generating the code coverage of Behat tests using a special bit of code and the $_SERVER superglobal to detect what parts of the code is being executed.

Yes, I know, it sounds silly, but bear with me. The nature of acceptance tests is not really to tests units of code, but to assure that the behavior of your application meets a certain set of criteria (Behat Scenarios). When your applications grow over time, code coverage can be a nice tool to help you pinpoint where you need to add more tests. In a perfect world tests are added while implementing new features so that your applications are always fully tested, but that isn't always as easy as it sounds.

The first chunk of code is something that would go in the router of your application, capturing the "collect coverage" and "enable coverage" input variables. The other part of the code creates a unique ID in the set up and uses it in a call (via Guzzle) to the server to start the tracking. In the tear down method, it sends the call to get the coverage results and process them through the PHP_CodeCoverage tool from Sebastian Bergmann.

0 comments voice your opinion now!
code coverage behat test tutorial functional

Link: http://tech.vg.no/2014/01/21/generating-code-coverage-of-behat-tests

Codeception.com:
Working with PHPUnit and Selenium Webdriver
November 21, 2013 @ 12:15:43

On the Codeception site they've recently posted a guide to using PHPUnit and the Selenium Webdriver to easily create functional tests for your application. They make use of the php-webdriver library from Facebook to make the connection inside the tests.

In this post we will explore some basics of user acceptance testing with Selenium. We will do this with classical unit testing framework PHPUnit, web browser Firefox, and with new php-webdriver library recently developed by Facebook. Selenium allows us to record user actions that we do inside a browser and then automate them. PHPUnit will be used to do various assertions and check them for fallacy. And php-webdriver is used to connect PHP with Selenium, in order to do browser manipulation in PHP.

They walk you through the installation process (pretty simple with Composer) and show you how to start up a standalone Selenium server to receive the test commands. From there they start in on the test examples make with PHPUnit, first creating a simple test that connects to Github and looks for "Github" in the page title. They list some of the more complex selector functions and put them to use finding an object by ID. Finally, they include a few handy tips about locating elements, handling "not found" items and some refactoring and test structure suggestions.

0 comments voice your opinion now!
phpunit selenium webdriver facebook tutorial functional testing

Link: http://codeception.com/11-12-2013/working-with-phpunit-and-selenium-webdriver.html

Anthony Ferrara:
Beyond Object Oriented Programming
November 12, 2013 @ 11:56:36

Following up on his previous post talking about going "beyond inheritance" in object-oriented development in PHP, Anthony Ferrara has a new post extends the subject, focusing more on types of classes and how his thoughts would apply.

In the last post Beyond Inheritance, we talked about looking past "types" and reasoning about objects differently. The conclusion was that inheritance wasn't necessary for OOP, and often results in more problems than it solves. Well, let's go beyond that and explore more of what will come from treating objects as containers of behavior. Let's look at what this means for various kinds of classes.

He looks at five different class types and gives a brief summary of the concepts they represent - Representers, Doers, Plumbers, Translators and Makers. He then shifts over to investigating how this all applies to the SOLID development principles. He follows this pattern of thought through and looks at how it breaks things down into decomposable behaviors and, ultimately, functional programming/code structures (including the suggestions that creating ValueObjects is directly related).

0 comments voice your opinion now!
beyond oop types solid development functional valueobject

Link: http://blog.ircmaxell.com/2013/11/beyond-object-oriented-programming.html

Chris Jones:
DTracing a PHPUnit Test Looking at Functional Programming
November 04, 2013 @ 11:04:20

On his Oracle blog Chris Jones has shared more details about using DTrace for dynamic tracing of the execution of your application. In this new post he looks more specifically at using it to trace through a PHPUnit test for a functional programming example.

I was reading the article Functional Programming in PHP by Patkos Csaba and wondering how efficient this type of programming is. I thought this would be a good time to fire up DTrace and see what is going on. Since DTrace is "always available" even in production machines (once PHP is compiled with --enable-dtrace), this was easy to do.

Using the code provided from the other post he sets things up to run some sample tests via PHPUnit. He makes a simple DTrace D script to configure a tracer to watch for "function entry" and "function exit" during execution, outputting the function tree each time when the given function is found (via a parameter). He includes both the command to run the test with the trace and an example of the output result.

0 comments voice your opinion now!
dtrace linux phpunit unittest functional programming example

Link: https://blogs.oracle.com/opal/entry/dtracing_a_phpunit_test_looking

NetTuts.com:
Functional Programming in PHP
October 04, 2013 @ 10:52:24

On NetTuts.com today they've posted an introduction to functional programming in PHP. Functional programming is a programming style that "treats computation as the evaluation of mathematical functions and avoids state and mutable data. Functional programming emphasizes functions that produce results that depend only on their inputs and not on the program state."

The new hype in programming is all about functional programming paradigms. Functional languages are used more and more in greater and better applications. Scala, Haskel, etc. are thriving and other, more conservative languages like Java started to adopt some of the functional programming paradigms (see closures in Java7 and lazy eval for lists in Java8). However, what only few people know is that PHP is quite versatile when it comes to functional programming. All the main functional programming concepts can be expressed in PHP.

The tutorial introduces some of the basics of functional programming, including terminology and the flow of the average functional application. They list some of the limitations that PHP developers might be used to (like not assigning values to normal variables) and some example code to get you started. There's also unit tests (PHPUnit) included to help you understand what the code is doing as it progresses. They also provide a more practical example - a basic auth and admin system to verify access.This tutorial is definitely not for those just learning PHP, but it's a good look into another, very different, programming style.

0 comments voice your opinion now!
functional programming tutorial introduction

Link: http://net.tutsplus.com/tutorials/php/functional-programming-in-php/

Anthony Ferrara:
Taking Monads to OOP PHP
July 15, 2013 @ 11:21:42

Anthony Ferrara has a new post to his site about a concept from functional programming - monads - and how he's tried to bring them to PHP with a bit of proof of concept code.

Lately I've been playing around with some functional languages and concepts. I have found that some of these concepts are directly applicable in the OOP code that I've been writing. One of those concepts that I think is worth talking about is the Monad. This is something that every functional developer tries to write a tutorial on, because it's such a cool but hard to grasp concept. This post is not really going to be a Monad tutorial per se, but more of a post about bringing the general concept to OOP, and what that looks like.

He starts off with a brief definition of what a "monad" is, defining it as a sort of "state container." He then gets into the examples (using this code) showing how to create a Monad and bind functionality to it. He walks through some examples of the transformations you can do with it and introduces the ListMonad as an alternative for looping.

0 comments voice your opinion now!
monads functional programming proofofconcept maybemonad listmonad

Link: http://blog.ircmaxell.com/2013/07/taking-monads-to-oop-php.html

Codeception.com:
Getting on Testing Ship
June 13, 2013 @ 11:06:54

On the Codeception blog there's a new post that advocates getting on the testing ship even if the project you're currently on isn't using tests (or TDD).

In this blogpost we will try to figure out how to get faster into the testing. What tests to write at first? Let's say we already have a project and we didn't practice TDD/BDD developing it. Should we ignore testing at all? Definitely no. So where should we start then?

They suggest a three-tiered pyramid approach - UI at the top, Integration testing in the middle and Unit testing as the foundation. They talk about the times when testing doesn't make sense, like when your application is based on a third-party tool (like WordPress or Drupal). They recommend starting with functional testing and working your way back down, especially if your framework supports it. Obviously they encourage the use of Codeception for it, but also recommend even something like Selenium tests if nothing else.

0 comments voice your opinion now!
testing unit functional integration codeception skip

Link: http://codeception.com/06-12-2013/getting-on-testing-ship.html


Community Events





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


api zendserver library deployment update install package list tips framework series community language symfony laravel opinion release introduction interview podcast

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