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]:
Build a VM for Drupal 8 with Vagrant
November 26, 2014 @ 10:22:22

A new tutorial has been posted on the php[architect] site today showing you how to build a VM for Drupal 8 with the help of Vagrant.

At this year's php[world] hackathon, I spent my time getting a Vagrant machine configured to run Drupal 8. I know there are other options, like Acquia's own Dev Desktop, or even Zend Server. However, I like using Vagrant to run my LAMP stacks, especially on OS X. I've never been able to easily run xAMP on non-Linux machines. Installing MySQL can be a pain, system updates can change the version of PHP you're running, and some PHP extensions are really difficult to build-even with Homebrew. Vagrant simplifies getting a working development environment running by automating the provision of a virtual machine for you, usually with a tool like Chef, Puppet, or Ansible.

Oscar (the author) took advantage of some time at the php[world] hackathon to create the necessary files for building this environment. He walks you through the steps to creating the basic vagrant file with "config" options (explaining each one) and walks through the setup of additional options, software like Apache and Drupal. He then sets up the Ansible configuration to create the box, run the provisioning and configuration of the resulting server. Finally, he shows the result of the install if everything was successful.

0 comments voice your opinion now!
drupal8 vagrant vm virtualmachine tutorial introduction configuration provision

Link: http://www.phparch.com/2014/11/build-a-vm-for-drupal-8-with-vagrant/

Dejan Angelov:
Experimental upgrading to Laravel 5 How I did it
November 24, 2014 @ 12:57:18

In a recent post Dejan Angelov shares the process he went through to upgrade an application to Laravel 5, yet to be released (at least at the time of this post).

Over the past weeks, Taylor introduced many great changes and new features that we'll be able to use in the new version, firstly numbered 4.3 and later 5. According to the framework's six month release cycle, it should had hit stable late this month or in early December. Because of that, I started to play with it and to apply the changes to make my application use it.

However, a couple of days ago, Taylor wrote a blog post on the Laravel's blog saying that because of the importance of this release, the release date will be postponed to January. Considering this, everything you'll read here MUST NOT be applied to applications that are currently in production.

He starts with some of the major differences, including changes in the dependencies required and the removal of the "start.php" file for bootstrapping the application. He talks about the changes in startup and shutdown as well as autoloading. He looks at directory structure changes and the addition of a base namespace. He then gets into how to fix these issues, one at a time, including code and configuration changes that need to be made. This includes updates to the facades, changes for middleware, environment configuration, pagination and routing. There's lots of other changes happening with Laravel 5, so be sure to check out the full post if you're interested in the steps you might need to take when this latest version is released.

0 comments voice your opinion now!
upgrade laravel5 framework change configuration code fix

Link: http://angelovdejan.me/2014/11/22/experimental-upgrading-to-laravel-5-how-i-did-it.html

Mattias Geniar:
The PHP circle from Apache to Nginx and back
November 20, 2014 @ 10:26:28

In this new post to his site Mattias Geniar goes in circles...from Apache to Nginx and back in terms of how it relates to PHP.

As with many technologies, the PHP community too evolves. And over the last 6 or 7 years, a rather remarkable circle has been made by a lot of systems administrators and PHP developers in that regard.

He talks about the "early days" and the rise of Apache as the "A" in the LAMP stack. Then Nginx was created/released and PHP developers saw it as a viable option. He talks about how PHP worked with this server and the solutions that were found to "hack" them together. There were issues around the relationship, though, and - in the author's perspective - the circle has come back around to Apache, just with a bit more smarts about how it's configured.

0 comments voice your opinion now!
circle apache webserver nginx opinion configuration phpfpm

Link: http://ma.ttias.be/php-circle-apache-nginx-back/

SitePoint PHP Blog:
Getting Started with Symfony2 Route Annotations
November 06, 2014 @ 09:27:25

On the SitePoint PHP blog today there's a new tutorial posted that gets into the details on one of the powerful (and most used) components of the Symfony framework, the Router, and how to interact with it via annotations. Symfony's route annotations allow you to define functionality at the controller level or via a YAML configuration file.

When you download the Standard Symfony 2 Distribution, it includes an interesting bundle named SensioFrameworkExtraBundle which implements a lot of great stuff, especially the opportunity to use annotations directly within your controllers. The idea behind this article is not to convice developers to embrace this way of doing, but to point the finger at an alternative method to easily configure controllers. Keep in mind that there is no magic recipe, it depends on what you need in each specific scenario. Symfony 2 implements a strong built-in component to manage all the routes of an application: the Routing Component. Basically, a route maps a URL to a controller action.

His example sets up a simple blog and compares the two ways of configuring the routing: one side putting it all in the YAML configuration and the other in the controller docblocks (annotations) themselves. He adds a base page for showing the listing of posts and a single article route, complete with slugs. He also shows how to add in some additional configuration handling to do things like set default values, making things required and enforcing the HTTP method on the request (GET, POST, PUT, etc)

0 comments voice your opinion now!
route annotations introduction docblock tutorial yaml configuration settings

Link: http://www.sitepoint.com/getting-started-symfony2-route-annotations/

Matthias Noback:
Composer "provide" and dependency inversion
October 06, 2014 @ 09:53:20

Matthias Noback has a new post today responding to a recent post talking about virtual packages with Composer (using "provide") and some of his own thoughts of how it relates to dependency inversion.

This is a response to Peter Petermann's article Composer and virtual packages. First, let's make this totally clear: I don't want to start an Internet war about this, I'm just pointing out some design issues that may arise from using Composer's provide option in your package's composer.json file. [...] Yes, if a user wants to run the code in your library, they need to have some class that implements [the "provides" requirement]. But no, this shouldn't be reflected in the dependencies of the library. Let me explain this by taking a look at the Dependency inversion principle.

He gives an example of using a specific package for logging (the Zend logger) and how that hard-coded dependency can be refactored out using one of two methods: either a custom interface or one described elsewhere. Getting back to "provide", he lists some reasons why he thinks that defining the interface itself in the Composer configuration is a good idea. These include:

  • Strictly speaking (as in, would the code compile), the code from the library itself [...] just needs the LoggerInterface (which happens to be in the psr/log package).
  • By depending on an implementation package, you basically undo any effort you made to depend on abstractions and not on concretions.
  • Some day, someone may decide to introduce another virtual package, called the-real-psr/log-implementation.
  • The notion of an "implementation package" is really vague. What does it mean for a package to be an implementation package.

Each of the reasons has a bit of description to go along with it. He also points out an interesting example where the package actually knows about existing virtual package, the DoctrinePHPCRBundle and its use of "jackalope" and "phpcr".

0 comments voice your opinion now!
composer dependency inversion provide configuration interface

Link: http://php-and-symfony.matthiasnoback.nl/2014/10/composer-provide-and-dependency-inversion/

SitePoint PHP Blog:
Asset Access Restriction Methods - Block Unwanted Visitors
September 05, 2014 @ 10:11:45

In a new tutorial from the SitePoint PHP blog today Jeroen Meeus looks at a way to protect parts of your application from being used and abused. He shows you how to protect various parts of you site, including images and actual pages, with the help of either your web server or bits of code.

When building an awesome web app or website, we sometimes want people to be able to embed parts of our web app/website into their own. That could be an iframe holding a 'like' button, a simple image that they want to reuse or even our entire app embedded in an iframe. But how do we control who has access, who is allowed to use up our bandwidth and query our service? We define the problem as controlling access to assets. By assets we mean: anything that can be queried from our site.

He talks about the problem of "lifting" content and how to fall back to a "deny all, allow some" mentality. He starts with examples of Apache configurations that use mod_rewrite to only allow requests that come from the current domain (trusted) and the "files" directive coupled with Deny/Allow. He also includes an nginx example, showing the same request handling. The code examples show how to use PHP and Javascript to prevent access the same way.

0 comments voice your opinion now!
asset protection method webserver configuration code tutorial

Link: http://www.sitepoint.com/asset-access-restriction-methods-block-unwanted-visitors/

Master Zend Framework:
Easy Cache Configuration With StorageCacheAbstractServiceFactory
August 07, 2014 @ 14:46:54

The Master Zend Framework site has posted a tutorial centered around caching in Zend Framework 2 applications. In this new post Matthew Setter looks at using the StorageCacheAbstractServiceFactory to handle the configuration and management of caching. The method is already implemented in the skeleton ZF2 application, so it makes it even easier to get started.

If you've been playing with Zend Framework 2 for some time, specifically the ZF2 Skeleton Application, you still may not have come across some of the pre-registered service manager abstract factory options. As I was browsing through the Application module's module.config.php recently, I came across this snippet [setting up the StorageCacheAbstractServiceFactory]. It was at that point I wondered why I'd spent time setting up caching using other methods, when this approach was already there and seemed to do a lot of the heavy lifting for me. So in this week's tutorial, I'm going to take you through how to use it, working with the default configuration provided in the manual.

He shows how to update the default configuration for the caching service including the caching type (the technology) and the configuration options to use. He mentions the kinds of caching available and provides a more "real world" example. This example uses the Laravel Homestead VM and a simple Redis server as the caching datastore. He sets up the configuration and shows how to access the caching service in both the controller and via dependency injection. He finishes off with a few lines of code showing how to use the caching to check for an item and, if not found, add it to the dataset.

0 comments voice your opinion now!
zendframework2 tutorial cache configuration storagecacheabstractfactory

Link: http://www.masterzendframework.com/servicemanager/storage-cache-abstract-service-factory-easy-cache-configuration

PHPBuilder.com:
Using PHP Configuration Patterns Properly
April 16, 2014 @ 11:52:11

On PHPBuilder.com today they have a new post showing different configuration patterns for getting localized settings into your applications. They show the use of INI files, PHP scripts, text files, XML data and a database call.

PHP is a cross platform language. It is a server based application so we must think about the configuration settings of the PHP software. There are various ways of creating configurable PHP applications. The configuration flexibility comes as a built in feature in PHP. But we must understand the requirement clearly before making an application configurable. This article explores different PHP configuration patterns and their implementation.

For each of the options mentioned, there's a brief description of what the method is, some of the common uses and a code example showing a basic implementation. The database pattern is the only one without a code example as the database interface varies widely from application to application.

0 comments voice your opinion now!
configuration pattern ini script text xml database

Link: http://www.phpbuilder.com/articles/application-architecture/using-php-configuration-patterns-properly.html

SitePoint PHP Blog:
Optimizing MySQL
April 04, 2014 @ 11:54:48

The SitePoint PHP blog has posted the first two parts of their "Optimizing MySQL" tutorial series by Peter Nijssen. The first looks at general tips around indexes and the second shows some configuration tips to get the most from your database systems.

MySQL is one of the most used databases in conjunction with PHP. Making sure that your MySQL databases are running at their best is one of the most important aspects you have to consider whenever your web application grows. In this series of 3 standalone articles, we will have a look at how we can optimize our MySQL installation. We will take a look at which optimizations we can perform on our database, on our MySQL configuration and how we can find potential problems when MySQL is not performing well.

The first tutorial walks you through a brief introduction to indexes, shows you how to find duplicates and unused indexes that might be hanging around. The second post deals with the configuration topics using the Percona pt-variable-advisor. They also make use of the MySQLTuner tool for even further enhancement. Finally, the article finishes with a look at cross-server configuration comparison and how to see the differences.

0 comments voice your opinion now!
mysql series performance percona configuration indexes

Link: http://www.sitepoint.com/series/optimizing-mysql/

Ralph Schindler:
Authentication & Authorization in Apigility
March 27, 2014 @ 11:04:21

Those interested in the Apigility project from Zend might want to check out this new post from Ralph Schindler on how it handles authentication and authorization for all of the requests.

Apigility takes a lightweight, layered, yet extensible approach to solving both problems of authentication and authorization. The infrastructure is already in place and ready to be configured to use, or for more advanced use cases: to be extended. Many of these feature can be easily explored through the Apigility user interface.

He gets into authentication first, defining it briefly before getting into the Apigility-specific implementation. He talks about the three methods (HTTP basic, HTTP digest and OAuth2) and mentions where it falls in the execution as well as some screenshots of its setup. Following this he talks about the other half of the equation, authorization. He covers the "Authentication" header, the identity types and where you can find the configuration settings. He finishes off the post with an in-depth look at the different components, events and services/models that make up the authentication and authorization system and make it work.

0 comments voice your opinion now!
authentication authorization apigility introduction configuration

Link: http://ralphschindler.com/2014/03/26/authentication-authorization-in-apigility


Community Events





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


update voicesoftheelephpant interview introduction series symfony opinion package security podcast framework library version mvc composer community tool laravel release language

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