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

Rob Allen:
Using ZendConfig with a Slim app
April 21, 2015 @ 09:11:31

Rob Allen has a quick post to his site continuing his theme of Slim framework-related posts with this new post showing how to use the ZendConfig module with a Slim application.

Sometimes you need more configuration flexibility for your application than a single array. In these situations, I use the ZendConfig component which I install via composer: composer require "zendframework/zend-config". This will install the ZendConfig component, along with its dependency ZendStdlib.

He shows how to use the glob function to have the component load a set of configuration files and the order they'd load in. He also points out that the ZendConfig component supports other formats including YAML and JSON data. He also includes a code example showing how you can load multiple formats at the same time (ex. some .php files and some .yml files with one call).

0 comments voice your opinion now!
slim application zendframework2 config component zendconfig tutorial introduction

Link: http://akrabat.com/using-zendconfig-with-a-slim-application/

Matt Stauffer:
Introducing Lumen from Laravel
April 14, 2015 @ 13:34:50

Taylor Otwell, lead developer of the Laravel framework, released a new micro-framework recently based on some of the same components and ideas behind the Laravel framework called Lumen. In this new post from Matt Stauffer you'll get a brief introduction to this new framework and how to get your own instance up and running.

Lumen is a new project from Laravel creator Taylor Otwell. It's a "micro-framework", meaning it's a smaller, faster, leaner version of a full web application framework. PHP has two other popular micro-frameworks, Slim and Silex. Lumen has the same foundation as Laravel, and many of the same components. But Lumen is built for microservices, not so much for user-facing applications (although it can be used for anything.) As such, frontend niceties like Bootstrap and Elixir and the authentication bootstrap and sessions don't come enabled out of the box, and there's less flexibility for extending and changing the bootstrap files.

Matt shows how to get a copy of the framework installed and how to enable some common features. He includes examples of route definitions, API callers and using the simple caching mechanism.

0 comments voice your opinion now!
lumen laravel microframework introduction install tutorial

Link: https://mattstauffer.co/blog/introducing-lumen-from-laravel

NetTuts.com:
Design Patterns The Singleton Pattern
April 14, 2015 @ 12:31:44

On the NetTuts.com site today they've posted another in their series introducing the various design patterns that have been established in software development. In this new post they talk about the Singleton pattern (or "anti-pattern" as it's sometimes called).

In this article you are going to learn how to implement the Singleton design pattern, and why and when to use this pattern in your application. As the name "Singleton" suggests, this method allows us to create one and only one object of a class.

They start with a basic definition of the pattern that, at its heart, is about reusing one and only one instance of an object. To help make it more concrete, they include an example that's refactored to use the Singleton pattern: creating and reusing single instances of database connections (PDO). The article also talks a bit about the idea of the Singleton being an anti-pattern and how it can make things like unit testing difficult.

0 comments voice your opinion now!
designpattern tutorial series singleton introduction

Link: http://code.tutsplus.com/tutorials/design-patterns-the-singleton-pattern--cms-23073

SitePoint PHP Blog:
Symfony2 Console Getting Started with Console Helpers
April 09, 2015 @ 10:44:03

If you've ever worked with the Symfony Console component and wanted to enhance the experience with some additional functionality, check out the latest tutorial from the SitePoint PHP blog: Symfony2 Console: Getting Started with Console Helpers.

In this tutorial, I'll share my experiences and we'll give some extra love to the console helpers, which provide us with a large collection of handy functions. There are a lot of reasons to create console commands in your projects: sending emails, exporting/importing data, creating users, and so on. [...] By the end of this post, we want to be able to create a basic console command to generate some output - any output will do - only the way to getting there is important. Near the end, we'll discover some console helpers in order to create some nice interactions between users and the interface.

He starts by helping you get the component installed via Composer and creating the first simple command line script (a ConsoleApplication). He shows how to add in a basic "hello world" command (conveniently named "BasicCommand") and the result when executed. With this in place, he starts in on three helpers:

  • Question Helper
  • Table class
  • Progress Bar

Each includes the code needed to implement it and the resulting output. You can find out more about the component in the Symfony2 documentation.

0 comments voice your opinion now!
symfony2 console tutorial command helpers introduction question table progressbar

Link: http://www.sitepoint.com/symfony2-console-getting-started-console-helpers/

Pádraic Brady:
Introduction to Humbug A Mutation Testing Framework for PHP
April 08, 2015 @ 09:34:13

While he's mentioned it in other posts to his site, Pádraic Brady has officially posted an Introduction to Humbug to his site today. Humbug is a mutation testing framework that lets you determine the actual effectiveness of your unit tests through "mutation testing" methods.

You may already be familiar with the concept. In Mutation Testing, defects which emulate simple programmer errors are introduced into source code (your canonical code is untouched) and the relevant unit tests are run to see if they notice the defect. The more defects that are noticed, the more effective the test suite is presumed to be. The methodology relies on the theory that a quantity of relatively simple defects, either in isolation or combined, provide as much useful information as would a series of more complex defects.

He talks about the differences between mutation testing and the more traditional code coverage metrics. He points out that code coverage, while a decent high-level metric, should never be used as a quality metric. Using Humbug allows you to determine the real effectiveness and "coverage" of what you're testing. He then gets into how to use the tool, outlining:

  • Installation of the library as a phar
  • Generating a configuration file
  • Execute the command to run your tests (to ensure they're passing) and execute the mutation testing

The execution is broken into several stages: executing your tests for passing, breaking up the source into tokens to determine mutability, replacement of content with mutations in a temporary version of the source and a final execution of the test suite to determine the mutation results. He includes some example output from the tool on a moderately large codebase and how to interpret these results. He ends the post talking about the logs that Humbug generates, the overall performance of the tool and an experimental feature that's in the works called "Incremental Analysis".

0 comments voice your opinion now!
humbug mutation testing framework tool library introduction example

Link: http://blog.astrumfutura.com/2015/04/introduction-to-humbug-a-mutation-testing-framework-for-php/

DZone.com:
Understanding php.ini
April 03, 2015 @ 11:05:55

The Dzone.com site has a recently posted tutorial helping you understand the php.ini, the main configuration file PHP uses to set up its own internal features and settings.

our php.ini file provides a considerable amount of power over the behavior of your PHP application ecosystem. Let's jump into some of the most common declaratives and discuss how they impact your application performance and behavior. I won't go into an explanation of each setting that is available, but I'll cover the fundamental options that you should be aware of. Please keep in mind that changing any of the settings on in your php.ini can and may very well change the behavior of your application, whether positive or unfavorable. Please use caution when adjusting your settings, consult with your team, do your research, understand the implications, and, of course, test, test, and test again before deploying anything into production!

He starts with a brief introduction to what the php.ini file is and how you can use the phpinfo function to find the current settings in HTML form (on the command line it's "php -i"). He then goes through and covers some of the basics from the standpoint of security, memory handling and some general settings.

0 comments voice your opinion now!
understand phpini configuration file introduction

Link: http://php.dzone.com/articles/understanding-phpini

Scotch.io:
A Beginner's Guide To Composer
March 31, 2015 @ 13:48:55

The Scotch.io site has posted a guide that can help you if you're just getting started in the world of PHP packages via Composer. In this new tutorial Daniel Pataki introduces you to the tool and how to use it to install the dependencies you need.

I'm sure there are plenty of coders out there who are wondering about the benefits of using composer and many who are afraid to make the leap into a new system. In this article we'll take a look at what exactly Composer is, what it does and why it is a great tool for PHP projects.

He starts with the basics of dependency management, why it would be used in a project and how it automates the installation and integration of 3rd party libraries. From there he helps you get Composer installed and starts in on a sample "composer.json" configuration file. In his example he installs Monolog, the popular PHP logging class. He talks some about how to specify versions, locking down the dependency versions to install and installing "developer only" requirements.

0 comments voice your opinion now!
composer package dependencies library introduction beginner guide

Link: https://scotch.io/tutorials/a-beginners-guide-to-composer

ServerGrove Blog:
New Symfony installer the fastest way to start your Symfony project
March 27, 2015 @ 12:13:42

The ServerGrove blog has a new post today introducing the new Symfony Installer, a tool that can make getting started with a Symfony2 application quick and easy.

Yesterday, the Symfony team introduced the new Symfony installer. Its main goal is to help developers to create Symfony projects faster. Until now, installing Symfony to start a new project required a few steps. [...] The installer tries to do this in one step. It downloads a compressed file with all the code, including the vendors directory, so you don't need anything else to run Symfony for the first time.

The post shows you how to install the installer via a curl call to fetch the executable. They show how to use it to create a new project, making a demo project and the resulting application and web interface for the demo. They also mention some of the future work that's planned for the installer including HTTPS support and caching improvements. The post finishes up with a quick mention of the code "under the hood" using the Symfony console component.

0 comments voice your opinion now!
symfony installer introduction demo tutorial example command console

Link: http://blog.servergrove.com/2015/03/27/new-symfony-installer-fastest-way-start-symfony-project/

Kristopher Wilson:
Using Interfaces Effectively in PHP
March 27, 2015 @ 10:12:32

Kristopher Wilson has a quick post talking about how he thinks you can use interfaces effectively in PHP applications.

Yesterday, a question appeared on Reddit about the purpose of interfaces in PHP. While I was too late to the party to provide an answer to that thread (at least that would get noticed by anybody), I thought it was a great topic of conversation. So let's take a look at interfaces in PHP.

He introduces some of the basics around interfaces and provides some sample code showing how they're created and used (and extended). He talks about some good practices for implementing them in your classes and how this fits into the world of dependency injection. He also includes a bit about type hinting based on the interface implemented and how they can be seen as "contracts" in your code.

0 comments voice your opinion now!
using interface contract introduction example extend

Link: http://kristopherwilson.com/2015/03/26/using-interfaces-effectively-in-php/

PHPBuilder.com:
Working with the PayPal API
March 27, 2015 @ 09:57:34

PHPBuilder.com has posted a tutorial showing you how to interact with the PayPal API via your PHP application using their own PHP-SDK.

PayPal recently introduced a new RESTful API that is more convenient and more powerful than the previous version. In this article, I will show you how to integrate your PHP application with the new PayPal API.

They start with a summary of the PayPal API and how to get the SDK loaded and ready to use (either through Composer or manually). The tutorial walks you through the authorization process (OAuth) and the code you'll need to make it happen. They also show you how to create transaction (including currency type and description) after the items have been submitted. There's also some code showing you how to get the current status of the payment once it has been submitted.

0 comments voice your opinion now!
paypal api tutorial introduction phpsdk rest

Link: http://www.phpbuilder.com/articles/application-architecture/shopping-carts/working-with-the-paypal-api.html


Community Events

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


interview framework voicesoftheelephpant conference library language community install podcast opinion laravel api release introduction series performance laravel5 extension php7 example

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