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

Anthony Ferrara:
What About Garbage?
December 03, 2014 @ 13:33:44

In his latest post Anthony Ferrara looks at a recent change in the Composer dependency management tool involving a major speed boost, just from disabling the garbage collection.

If you've been following the news, you'll have noticed that yesterday Composer got a bit of a speed boost. And by "bit of a speed boost", we're talking between 50% and 90% speed increase depending on the complexity of the dependencies. But how did the fix work? And should you make the same sort of change to your projects? For those of you who want the TL/DR answer: the answer is no you shouldn't.

He talks about what the actual (one line) change was that sped things up but goes on to talk about why doing this isn't necessarily a good thing. He covers how PHP handles variables internally, how it relates to "pointers" and the copy-on-write functionality. He includes code snippets and gives an overview of how each would be handled by the interpreter. Unfortunately, the way PHP handles things, deleting a variable only removes variable reference, not the value, but does decrement the reference count for it. When that hits 0, garbage collection kicks in and removes associated values too.

He talks about a few other kinds of garbage collection (the reference count method is just one of them) and circles back around to how this relates to Composer's functionality. He points out the number of objects created during the dependency resolution process and what can happen when the root buffer, populated with all of these objects, gets too full (hint: garbage collection). He finishes the post talking about how, in Composer's case, the garbage collection change yielded the performance impact it did, but doesn't suggest it for every project. He also makes a few suggestions as to things that could be done to improve PHP's garbage collection handling.

0 comments voice your opinion now!
garbage collection handling composer disable detail

Link: http://blog.ircmaxell.com/2014/12/what-about-garbage.html

NetTuts.com:
Digging in to Laravel's IoC Container
November 25, 2014 @ 12:23:07

NetTuts.com has a new tutorial posted that digs into the Laravel IoC (Inversion of Control) container, one of the key features of the framework making it easy to create and use objects all around your applications.

Inversion of Control, or IoC, is a technique that allows control to be inverted when compared to classical procedural code. The most prominent form of IoC is, of course, Dependency Injection, or DI. Laravel's IoC container is one of the most used Laravel features, yet is probably the least understood.

He starts with an example of basic dependency injection (constructor injection) and how this relates to the Laravel framework's IoC handling (hint: it's all IoC). He includes examples of some built-in Laravel bindings and talks about the difference between shared and non-shared bindings. He also looks at conditional binding, how dependencies are resolved and how you can define your own custom binding implementations. Other topics mentioned include tagging, rebounds, rebinding and extending. He ends the article with a look at how you can use the IoC outside of Laravel too.

0 comments voice your opinion now!
laravel ioc container inversionofcontrol framework tutorial introduction detail

Link: http://code.tutsplus.com/tutorials/digging-in-to-laravels-ioc-container--cms-22167

Anthony Ferrara:
A Lesson In Security
November 03, 2014 @ 09:11:49

In his most recent post Anthony Ferrara gives a lesson in security prompted by the recent major issue with a SQL injection vulnerability in Drupal. He gets into detail about the vulnerability itself and the ultimate question: "how could this happen?"

Recently, a severe SQL Injection vulnerability was found in Drupal 7. It was fixed immediately (and correctly), but there was a problem. Attackers made automated scripts to attack unpatched sites. Within hours of the release of the vulnerability fix, sites were being compromised. And when I say compromised, I'm talking remote code execution, backdoors, the lot. Why? Like any attack, it's a chain of issues, that independently aren't as bad, but add up to bad news. Let's talk about them: What went wrong? What went right? And what could have happened better? There's a lesson that every developer needs to learn in here.

He details (complete with code examples) where the vulnerability was, how it could be exploited and what the resulting SQL would look like when it was abused. Fortunately, the fix for the issue was relatively simple, but fixing is easy - distributing that fix is much more difficult.

How did this happen? Everyone makes mistakes. Everyone. It's going to happen sooner or later. Heck, this vulnerable code was in the database layer since 2008, and was just discovered two weeks ago. That says something about how complex vulnerabilities can be.

He suggests that the bigger lesson here isn't about who made the mistake or even the code that caused it. It's more about how it was handled, and that, in using any kind of CMS/framework like this there's always risk. People are human, people make mistakes - "the key is how you deal with it".

0 comments voice your opinion now!
security drupal vulnerability detail lesson risk handle

Link: http://blog.ircmaxell.com/2014/10/a-lesson-in-security.html

Anthony Ferrara:
A Followup To An Open Letter To PHP-FIG
October 17, 2014 @ 11:51:35

Based on some of the responses to his previous open letter to the PHP-FIG (Framework Interoperability Group), Anthony Ferrara has posted a follow-up explaining some of his points made and the caching proposal in a bit more detail.

A few days ago, I wrote An Open Letter to PHP-FIG. Largely the feedback on it was positive, but not all. So I feel like I do have a few more things to say. What follows is a collection of followups to specific points of contention raised about my post. I'm going to ignore the politics and any non-technical discussion here.

He points out that while the previous post wasn't completely about the cache proposal (it was used as a "literary device") there was some confusion on it. He walks through the "unnecessary complexity" he sees with it, citing code examples, and makes points about performance, memory usage handling stampede protection and the creation of standard ways to avoid it. He ends the post with a look at group invalidation handling and two ways it could be accomplished, either via namespacing or through tagging the items and using that as a reference point for the invalidation.

0 comments voice your opinion now!
open letter phpfig cache proposal detail opinion problem

Link: http://blog.ircmaxell.com/2014/10/a-followup-to-open-letter-to-php-fig.html

SitePoint PHP Blog:
Continuous Deployment Revisited
September 19, 2013 @ 12:52:50

On the SitePoint PHP blog today David Shirley has a new tutorial looking at continuous deployment with a bit more detail than his previous post.

In an earlier article I talked about what Continuous Deployment was and how it fits into the modern programming process. We took a small swipe at how it works, but some people (okay, one person) felt that I could have gone into more detail and they were right. [...] The essence of Continuous Deployment is that you use automated tools to do a lot of the heavy lifting. This means there may or may not be a bit of a learning curve when you first get started. A number of software elements are brought into play, and if you already know how to use those, great. If you don't, just remember that this is a learning curve, not a barrier.

He's broken down the rest of the tutorial into sections relating to the different pieces needed to effectively set up a continuous deployment (CD) system:

  • Effective use of version control
  • Commitment to automated testing
  • Setup and use of automated build software
0 comments voice your opinion now!
continuous deployment series detail versioncontrol testing build software

Link: http://www.sitepoint.com/continuous-deployment-revisited

Sherif Ramadan:
PHP OOP Objects Under The Hood
December 04, 2012 @ 09:15:27

In another of his series looking "under the covers" at what actually happens in the PHP language during its use, Sharif Ramadan has posted this look at the object handling in PHP's OOP functionality.

I would love to take a good long look under the hood at just how PHP objects and classes do the work that they do, and hope that you could benefit from that knowledge. [There are] many questions that come across my desk, on a regular basis, from developers and beginner PHP enthusiasts that I've worked with over the years, and are some of the key points this article attempts to help you answer.

He talks about classes "giving birth" to objects, how they're stored internal to PHP and how they provide the "blueprints" for it to lay out the storage of the object's data. He talks about using identifiers for variable/property access, object handlers and how "$this" fits into all of it. He notes that OOP, while a major part of PHP now, wasn't in the initial versions (until around PHP4). He finishes off the post talking about lateral/vertical context switching, the lifecycle of an object and the "early binding problem" and class scope.

0 comments voice your opinion now!
oop language class object detail lowlevel behindthescenes


Eric Lamb's Blog:
Practical PHP Reflection
March 04, 2011 @ 12:23:28

Eric Lamb came up against an interesting situation recently and found that PHP's Reflection API was the best thing to come to his rescue.

The perfect problem where the Reflection API appears to be the perfect solution. For me this came up a couple months ago while I was working on a European zip code radius project that had to be built using one of those obfuscated and ill documented 3rd party commercial programs (nothing worse than when the platform is forced on you). So, I had to use this program that was intentionally encoded to prevent me from doing what I wanted to do. I couldn't even look at the code; it was completely obfuscated.

To illustrate his point, he gives examples of two built-in classes that PHP has and the result of their reflected output - SimpleXMLElement and DateTime. He shows how to get the structure of the class in general and how to use some of the more specific functions to get things like properties, methods and constants for the class. This is perfect for those undocumented features and isn't too far of a jump away from building out your own documentation.

0 comments voice your opinion now!
api reflection detail class tutorial


Reddit.com:
Today I learned about variable variables...
October 21, 2010 @ 12:05:30

Over on Reddit.com there's an interesting post (yes, despite some of the comments made on it) about variable variables that turns into a detailed look at PHP variable handling as based around "$".

OK, here's the thing: [variable variables are] only the entrance of the rabbit hole. [...] The first thing to understand is what $ is. $ is actually a shorthand for ${} and means "return the value of the variable whose name is contained in this".

The response goes on to talk about variable names as strings, a few string handling tricks that can be used when referencing them and how this works with objects too. Things get a bit more complicated when they start adding in more levels of "variable" and evaluations based on random results. Not overly useful information for the casual developer, but interesting to know none the less.

0 comments voice your opinion now!
variable variable detail guide handling


Blue Parabola Blog:
Magento Feature Analysis Series, Part 6 Customer Service Offering
September 02, 2009 @ 07:58:39

Matthew Turland has posted the sixth part of his series taking a detailed look at the features of the popular Magento e-commerce platform on the Blue Parabola blog today.

In this new article he covers:

  • Contact Us Form
  • Feature-Rich Customer Accounts
  • Order History with Status Updates
  • Order Tracking from Account
  • Forgot Password E-mail
  • Order and Account Update E-mails
  • Customizable Order E-mails
  • Create and Edit Orders from the Admin Panel

Each item on the list comes with its own description and definition (as well as a few links to other resources where applicable).

0 comments voice your opinion now!
magento detail feature


Davey Shafik's Blog:
Detailed IDE Reviews How do you want to do this?
March 17, 2009 @ 13:45:14

As a follow-up to the IDE comparisons he's done Davey Shafik has asked the interested for a little feedback on how they think he should move forward with the more detailed reviews of each tool.

So, dear readers, I'm doing the IDE reviews for all of you guys and there's two ways I can proceed: I can take each of the requirements and do a single post per requirement with a writeup about it in detail for each of the 4 IDEs - then I was thinking for each new IDE I try, I can hit those same points. Or I can write up specifically on a single editor at a time, covering all of the requirements and I will also then review anything else about the editor etc.

He's thinking of doing a comparison of the Eclipse-based IDEs in their own right, but wants to get feedback on what would be the most useful for other developers to learn from. Several comments have already been made suggesting approaches to the topic, other editors that might be missing from the list and some support for the Eclipse comparison idea.

0 comments voice your opinion now!
ide detail review eclipse approach suggestion



Community Events





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


version podcast interview introduction framework library symfony artisanfiles community laravel series release opinion composer conference tool list language voicesoftheelephpant security

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