News Feed
Sections




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

DigitalOcean Community Blog:
Horizontally Scaling PHP Applications A Practical Overview
April 24, 2015 @ 13:06:49

On the Digital Ocean blog there's a new post with a "practical overview" of how to effectively scale PHP applications, specifically as it relates to horizontal scaling not vertical.

Shipping a website or application to production has its own challenges, but when it gets the right traction, it's a great accomplishment. It always feels good to see the visitor numbers going up, doesn't it? Except, of course, when your traffic increases so much that it crashes your little LAMP stack. [...] But fear not! There are ways to make your PHP application much more reliable and consistent. If the term scalability crossed your mind, you've got the right idea.

The article starts with a brief overview of what scalability is and the main difference between horizontal and vertical scaling (scaling out vs scaling up). They then get into a bit more detail about what horizontal scaling is and how it commonly works in relation to the average PHP application (complete with diagrams). They also talk about some things you can do inside your code to help make things flow a bit more smoothly including decoupling between services and user session/file consistency measures. There's also a bit at the end about load balancing but as that depends a good bit on what technology you're using and the actual load, they just provide an overview and some links to other articles and tutorials with more information.

0 comments voice your opinion now!
scaling application horizontal vertical decouple consistency loadbalance

Link: https://www.digitalocean.com/company/blog/horizontally-scaling-php-applications/

Christoph Rumpel:
Hello world, I am Laravel (5)
April 24, 2015 @ 12:46:22

With Laravel 5 out in the wild, you may be wondering what this new version has to offer either as someone already using the framework or brand new. In this recent post from Christoph Rumpel you can find out some of the highlights of this new release along with some code samples to illustrate.

So there is this thing called Laravel. You may have heard of it already, but you're not sure what it is actually about? Or you do, but want to know more about it and its great new features in version 5? Great, this post is especially for you! Laravel is at the same time one of the youngest and most popular PHP frameworks out there. So how does this work together? Let us take a closer look at why it is that popular and how it could be of use for you too. We will go through the main functionalities and talk about brand new features in version 5.

He touches on several different topics including: routing, use of the Eloquent ORM, the "artisan" command line tool, controllers, migrations and form request handling. Each section has some example code and a brief description of the feature. Obviously the Laravel documentation is a much more complete resource for each of these topics, but at least this gives you a feel for the framework and what it can do.

0 comments voice your opinion now!
introduction laravel5 framework version features overview

Link: http://christoph-rumpel.com/2015/04/hello-world-i-am-laravel/

ServerGrove Blog:
Useful Linux command-line tools to work with PHP projects
April 24, 2015 @ 11:16:20

The ServerGrove blog has posted a new tutorial with a selection of useful command line tools to help you in working with your PHP applications. None of them are PHP specific but are Unix-based commands that can help in every day development.

Linux provides a lot of interesting command-line tools that we can use when working with PHP projects. In this post we give you some useful commands.

They include examples of commands that can help with:

  • Find all PHP files in the current directory
  • Check the syntax of all PHP files in the current directory
  • Get the size of each Composer dependency
  • Find suspicious PHP files
  • Find files with abstract classes
  • List PHP settings for the xdebug extension
  • Find empty files and/or directories
  • List files currently open by a PHP process

As mentioned, most of the tools themselves are not PHP specific but these example commands do relate to things that are more in a PHP context.

0 comments voice your opinion now!
useful linux commandline tool context example list

Link: http://blog.servergrove.com/2015/04/23/useful-linux-command-line-tools-work-php-projects/

Pádraic Brady:
TLS/SSL Security In PHP Avoiding The Lowest Common Insecure Denominator Trap
April 24, 2015 @ 10:30:50

In his latest post Pádraic Brady shares his thoughts about the state of TLS/SSL functionality in PHP and how he thinks developers should avoid the trap of "lowest common denominator" and opt for insecurity.

A few weeks back I wrote a piece about updating PHARs in-situ, what we've taken to calling "self-updating". In that article, I touched on making Transport Layer Security (TLS, formerly SSL) enforcement one of the central objectives of a self-updating process. In several other discussions, I started using the phrase "Lowest Common Insecure Denominator" as a label for when a process, which should be subject to TLS verification, has that verification omitted or disabled to serve a category of user with poorly configured PHP installations.

This is not a novel or even TLS-only concept. All that the phrase means is that, to maximise users and minimise friction, programmers will be forever motivated to do away with security features that a significant minority cannot support by default.

He goes on to talk about how, in some places, targeting the lowest common denominator is okay, security isn't one of them. He also includes four basic concepts developers can adhere to to prevent this targeting:

  • You should never knowingly distribute insecure code.
  • You should accept responsibility for reported vulnerabilities.
  • You should make every effort to fix vulnerabilities within a reasonable time.
  • You should responsibly disclose vulnerabilities and fixes to the public.

He follows these up with three steps you can follow to migrate an insecure architecture into something much more robust. This includes identifying the consequences of the update and documenting the solutions you've chosen, be those configuration updates or library changes.

0 comments voice your opinion now!
tls ssl security lowest common insecure denominator trap avoid

Link: http://blog.astrumfutura.com/2015/04/tlsssl-security-in-php-avoiding-the-lowest-common-insecure-denominator-trap/

Sameer Borate:
Adding WordPress like shortcodes to your web applications
April 24, 2015 @ 09:14:50

Sameer Borate has posted a new tutorial showing you how to add shortcode-like handling to your application. Shortcodes are a feature that's common in tools like WordPress to make adding custom markup easier (like "[tag][/tag]").

One of the cool features of WordPress is its shortcode feature. There may be times one wished to add this capability to your PHP web applications. Recently I found one such library which allows you to add shortcode features to your web apps. The library discussed here implements WordPress style shortcode syntax as a standalone package. Its a small package and so can be easily integrated into you existing applications. Content from editors, databases, etc. can be scanned by the Shortcode Manager and the contents replaced by a custom callback.

He makes use of the maiorano84/shortcodes library (installable through Composer) that makes it simple to add the functionality to your existing application. He includes a few examples of tag formats that the library can parse and the code needed to parse and handle the formatting. The custom tags are processed via callbacks and can modify the incoming value easily. He also shows how to access any attributes that may be set on the codes and grouping all of his functionality into one self-contained class.

0 comments voice your opinion now!
shortcode wordpress tag custom library maiorano84 tutorial

Link: http://www.codediesel.com/php/adding-wordpress-like-shortcodes-to-your-web-applications/

Graze.com Tech Blog:
Sharing Controller Logic with Traits in PHP
April 24, 2015 @ 08:53:48

On the Graze.com Tech blog there's a recent post about sharing logic between controllers with the help of traits. He makes use of the traits functionality in PHP to abstract out functionality common to multiple controllers (in his case, common user functionality).

There have been a few times I have come across a situation where I need to share some logic between controllers but it hasn't been as clear cut as abstracting that logic out into a library. I've been pondering the best way to tackle this problem and would like to share my thoughts.

In his example he shows how two different controllers, the Account and Signup controllers, both need to be able to look up an address and perform some simple checks on the results. The logic is duplicated so he first tries to move it out to an abstract controller but notes that it's not the most ideal solution. Next he tries moving the code out into a library but finds issues with separating out the necessary concerns. Finally he moves the logic into a trait (AddAddressTrait) that contains it and allows the direct integration of his "lookupPostalCode" method into the controller without inheritance or other design issues.

0 comments voice your opinion now!
controller logic sharing traits tutorial library inheritance

Link: http://tech.graze.com/2015/04/14/sharing-controller-logic-with-traits-in-php/


David Lundgren:
When does Dependency Injection become an anti-pattern?
April 23, 2015 @ 12:11:53

In a new post to his site David Lundgren wonders when dependency injection becomes an anti-pattern when used in PHP applications. The idea of dependency injection is to provide objects with instances of other objects representing things they'll need to get the job done (goes along with separation of concerns). Unfortunately, if used incorrectly, DICs - dependency injection containers - can become less useful and more of a hinderance than a positive part of the application.

During my tenure as a seasoned, and tenderized, PHP developer I have used many design patterns: adapters, factories, data mappers, facades, etc. The most recent one that I have been working with is Dependency Injection. Inversion of Control is not a new idea, at least not in the programming world, but in the PHP world it seems to have taken us by storm in recent years. Every framework will often have a Dependency Injector built in, or offer it as a component for use. It is the hip thing to do in PHP, but I believe we need to take a step back and evaluate it for what we are really trying to achieve. That is reducing the tight coupling that our objects may have. I view it as removing the new-able's from our objects code, and handing the object creation over to something else to deal with.

He talks about how dependency injection containers and service locators relate to each other. He also suggests that, at the heart of every dependency injection container, there's a service locator. He gives an example of a project where a large number of dependencies are being injected and how, despite the assumption of flexibility, his dependencies don't change that often, making the DIC and its functionality a bit less important.

0 comments voice your opinion now!
dependencyinjection dic servicelocator antipattern designpattern opinion

Link: http://davidscode.com/blog/2015/04/17/when-does-dependency-injection-become-an-anti-pattern/

SitePoint PHP Blog:
StackPHP Explained
April 23, 2015 @ 11:40:02

The SitePoint PHP blog has a tutorial posted today that wants to help you understand StackPHP, the project centered around middleware, specifically related to the Symfony2 HttpKernelInterface.

Today we are going to look at StackPHP and try to understand what this thing is all about. Although this post will have some code, this article will be rather theoretical as we are interested in learning what StackPHP actually is, where it comes from and why it is useful. As the front page of the StackPHP project says, Stack is a convention for composing HttpKernelInterface middlewares. But, in order to actually understand this definition, we will have to cover a few concepts first. At the end, we will also illustrate the concepts we learned in the context of StackPHP with some example code.

They start with a brief look at the HttpKernelInterface and how it works with the overall request and response flow of a typical application request. From there they describe the Decorator design pattern that will be used to augment the request/response objects as they're going through the middleware process. Following this they look at how StackPHP fits into this picture and provides a few code examples showing both basic and a bit more complex middleware handling (including the use of StackBuilder).

0 comments voice your opinion now!
stackphp tutorial middleware httpkernelinterface symfony2 introduction

Link: http://www.sitepoint.com/stackphp-explained/

BitExpert Blog:
Processing CSV files in a memory efficient way
April 23, 2015 @ 10:50:59

In their latest post Florian Horn shares some of his experience in using the PHPExcel tool to parse CSV files and the performance issues he ran into. Fortunately, he found a solution...in the form of another library.

A little while ago I had to dive deeper into the performance optimized usage of PHPExcel. Our users are uploading files like Excel or CSV with a lot data to process. Initially we used the PHPEXcel instance without any tuning of the default configuration which lead to heavy memory issues on relativly small files. So I had to avoid reading all file content at ones to the buffer (like file_get_contents does).

In my research mainly optimizing the usage of PHPExcel I came across a tiny library I am grown really fond of. It is called Goodby/CSV. Both tools have a very well grounded documentation to read in and understand the basics and the usage.

He describes some of the main differences between the two tools and includes some basic benchmark results comparing memory consumption and overall speed.

0 comments voice your opinion now!
phpexcel csv file goodbycsv process performance memory benchmark

Link: https://blog.bitexpert.de/blog/processing-csv-files-in-a-memory-efficient-way/


Community Events

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


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

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