News Feed
Sections




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

php[architect]:
January 2015 Issue Released - Be the Boss
January 27, 2015 @ 13:18:45

php[architect] magazine has just released their January 2015 issue - "Be The Boss". This issue includes articles talking about freelancing, the importance of communication in open source and the usual columns.

This month is a personal favorite of mine, as the theme is "Be the Boss". It speaks to those who wish stop working as an employee and strike out on there own, something I've done twice in my life. In Get Off the Freelance Roller Coaster!, Yitzchok Willroth (@coderabbi) talks on the importance of not placing all of your eggs in one basket (or projects with one vendor). In Choose Your Own Adventure-Freelancer or Founder?, Joshua Warren talks about the two avenues that are open to those going it on their own, freelancer or business founder.

Articles in this month's edition include:

  • Get Off the Freelance Roller Coaster! (Yitzchok Willroth)
  • Choose Your Own Adventure - Freelancer or Founder? (Joshua Warren)
  • PHP and OS Communication (Julien Pauli)
  • An Introduction to NodeJS

The usual columns (Laravel Tips and Education Station) return once again as well as a a new one from David Stockton called "Leveling Up" to help you become a better developer. You can pick up your own copy from the php[architect] website.

0 comments voice your opinion now!
phparchitect magazine jan2015 issue release boss freelance

Link: http://www.phparch.com/magazine/2015-2/january/

SitePoint PHP Blog:
Starting a New PHP Package The Right Way
January 27, 2015 @ 12:08:09

In part one of a new series on the SitePoint PHP blog Bruno Skvorc looks at the right way to start a PHP package using a set of guidelines that have evolved recently in well-structured, well-tested PHP packages.

In recent years, good standards for PHP package design have popped up, in no small part due to Composer, Packagist, The League and, most recently, The Checklist. Putting all these in a practical list we can follow here, but avoiding any tight coupling with The League (since our package won't be submitted there - it's specifically made for a third party API provider and as such very limited in context).

The list of rules includes topics like having a license selected, using PSR-4 autoloading and having in-depth code comments. Bruno uses these as a foundation and starts in on the creation of a package. He uses the PHP League skeleton structure to create the files and folders for a basic package. From there he updates the contents with details for his Diffbot example and installing other needed software libraries. The rest of the post is broken up into the two remaining steps and examples under each: sticking with the PSR-2 guidelines and planning for the structure of the package.

0 comments voice your opinion now!
package tutorial introduction rightway phpleague skeleton checklist

Link: http://www.sitepoint.com/starting-new-php-package-right-way/

NetTuts.com:
Design Patterns The Simple Factory Pattern
January 27, 2015 @ 11:53:20

NetTuts.com has posted the next part of their series focusing on design patterns (and more specifically implementing them in PHP). In this latest post they look at a simple version of the Factory design pattern.

When you think of a factory, what comes to mind? For me, it's a place where things are created - that is, it's a centralized placed where things are produced. Later, the delivery of said products are done by the factory based on an order. Let's say that you're requesting a car. A factory will create one based on the specifications of the work order and will then deliver it once it's complete. Just as their real world counterparts, a software factory (that is, software that implements the factory design pattern), is an object that is responsible for creating and delivering other objects based on incoming parameters.

They mention the three different versions of the factory pattern but focus in on the simplest one (hence the "simple" in the title). They continue on with the car example, showing how to use a simple factory (a "carFactory") to build an instance of the "Car" class based on different classes of car types. The object is constructed when a "build" method is called with the type.

0 comments voice your opinion now!
designpattern simple factory car type example tutorial introduction

Link: http://code.tutsplus.com/tutorials/design-patterns-the-simple-factory-pattern--cms-22345

Matt Stauffer:
Extending Laravel's Application
January 27, 2015 @ 10:48:37

Matt Stauffer has a new post to his site today showing you how to extend Laravel's Application class to enhance its handling with other handy features.

It's seldom that we need to extend Laravel's core, and even when we do, it's most likely we're going to extend specific components, which is detailed in the docs. However, all of these instructions presume you're using the core Laravel Application (IOC Container) to extend the other classes. What if you want to extend the Application itself?

The example he provides is from his own real-world experience, based around changes they wanted to make in the default folder paths for things like the "storage" or "public" directories. He shares the three simple steps to making this custom handling work:

  • Extend the class
  • Register it in your application's bootstrap
  • Override/extend the current methods to add in your own functionality

In this case, changing the default paths is something that's under discussion already, but it gives a good simple example of changing that default functionality.

0 comments voice your opinion now!
extend laravel application class override register tutorial

Link: http://mattstauffer.co/blog/extending-laravels-application

Derick Rethans:
Questions from the Field Should I Escape My Input, And If So, How?
January 27, 2015 @ 09:22:04

In his latest post Derick Rethans shares his answer to a question he was asked at a recent PHP conference regarding the escaping of input before use in a MongoDB query.

At last weekend's PHP Benelux I gave a tutorial titled "From SQL to NoSQL". Large parts of the tutorial covered using MongoDB-how to use it from PHP, schema design, etc. I ran a little short of time, and since then I've been getting some questions. One of them being: "Should I escape my input, and if so, how?". Instead of trying to cram my answer in 140 characters on Twitter, I thought it'd be wise to reply with this blog post. The short answer is: yes, you do need to escape.

He uses the rest of the post to get into the longer answer, a bit more detail about why you should escape and what kinds of things can be done. He points out that, because of how MongoDB queries are created, SQL injection is much more difficult. He does remind you that superglobals can also be used to send arrays too which could lead to unexpected data input. He gives an example of how this would work and why it would be a problem.

So although MongoDB's query language does not require you to build strings, and hence "escape" input, it is required that you either make sure that the data is of the correct data type.
0 comments voice your opinion now!
escape input mongodb phpbnl15 question answer datatype

Link: http://derickrethans.nl/escape-input.html

Community News:
Packagist Latest Releases for 01.27.2015
January 27, 2015 @ 08:02:36

Recent releases from the Packagist:

Community News:
Latest PECL Releases for 01.27.2015
January 27, 2015 @ 07:06:29

Latest PECL Releases:
  • pecl_http 2.2.0 - var_dump(httpMessage) no longer automatically creates an empty body + Added httpMessageParser class + Made httpClient::once() and httpClient::wait() available when using events + Added httpUrl::PARSE_MBLOC, httpUrl::PARSE_MBUTF8, httpUrl::PARSE_TOIDN and httpUrl::PARSE_TOPCT constants + Added httpEnvResponse::setCookie() + Added httpEnvRequest::getCookie()

  • amqp 1.6.0beta1 1.6.0beta1 Release: * Add support for nested arguments values (Bogdan Padalko) * Add auto_delete and internal flags support for AMQPExchange::declare (librabbitmq version > 0.5.2 required) (Bogdan Padalko) * Fix persistence support (Bogdan Padalko) * Add AMQPExchange::unbind method and fix AMQPExchange::bind method. WARNING: this can potentially break BC * Add support to consume messages from multiple queues (Bogdan Padalko) * Add AMQP_DURABLE flag support to AMQPExchange::setFlags (librabbitmq version > 0.5.2 required) (Bogdan Padalko) * Fix inconsistent INI values comparison which leads to deprecation warnings (Bogdan Padalko) * Various segfault and memory leak fixes (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.4.0...v1.6.0beta1 1.4.0 Release: * Fix #72: Publishing to an exchange with an empty name is valid and should not throw an exception (lstrojny) * Fix #77: AMQPQueue::delete() now no longer returns a boolean, but an integer of how many messages were deleted. WARNING: this can potentially break BC (Bogdan Padalko) * Fix #75: adhering to the AMQP spec by closing channel and sometimes even the connection in case of certain errors (Bogdan Padalko) * Fix #81: Add optional arguments parameter to bind()/unbind() (Michael Squires) * Fix #82: additional getters (getChannel(), getConnection()) (Bogdan Padalko) * Fix #92: fix various memory leaks in the AMQPConnection class (Lars Strojny) * Using amqp_error_string2() instead of deprecated amqp_error_string() (Lars Strojny) * Fix memory leaks in setHost, setLogin, setPassword, setVhost (Lars Strojny, Bogdan Padalko) * Fixed a memleak in php_amqp_connect (Julien Pauli) * Use rabbitmq-c defaults for max channels and default frame size (Bogdan Padalko) * Fix socket timeout error when connecting over high-latency network (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.3.0...v1.4.0 1.3.0 Release: * Allow retrieving auto-delete exchanges (Guilherme Blanco) * Add connection timeout support. This requires bumping the version requirement for librabbitmq to >= 0.4.1 (Bogdan Padalko) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.2.0...v1.3.0 1.2.0 Release: * New methods AMQPChannel::getPrefetchCount() and AMQPChannel::getPrefetchSize() * Deprecate AMQPQueue::declare() in favor of AMQPQueue::declareQueue() * Deprecate AMQPExchange::declare() in favor of AMQPExchange::declareExchange() * Smaller fixes to our stubs For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.0.10...v1.2.0 1.0.10 Release: * report correct version in module info (Lars Strojny) * fix class interface definitions (Vladimir Kartaviy) * add ability to bind a queue with an empty routing key (Vladimir Kartaviy) * fix constant AMQP_IFUNUSED (Florin Patan, Bernhard Weisshuhn) * added stubs for ide use (Vladimir Kartaviy, Bernhard Weisshuhn) * Fixed memory leak in queue->declareQueue (Ilya a.k.a. coodix) * support for php 5.5 (Lars Strojny) * add support for read and write timeouts (Bogdan Padalko) * fix memory leak in queue->consume (Dmitry Vinogradov) * add support for custom exchange types (empi89) * support for nested custom headers (Bernhard Weisshuhn) * fix memory (Bernhard Weisshuhn) For a complete list of changes see: https://github.com/pdezwart/php-amqp/compare/v1.0.9...v1.0.10 1.0.9 Release: * Fix pecl relase 1.0.8 Release: * Skip var_dump test on PHP 5.2 * Initialize consumer tag string length to zero * Support connection time outs * Adding consumer_tag parameter to AMQPQueue::cancel * Clean up error code handling 1.0.6 Release: * 62354: Segmentation fault when printing or dumping an object that contains an AMQP object * Adding in missing tests * Fixing release number in PHP information * Adding .gitignore info for Git users * Cleaning up debug handling 1.0.5 Release: * 62696: Incorrect exchange type * Handles server connections being closed during consume and publish correctly * 62628: Exception thrown in consume will lock PHP * 61533: Segmentation fault when instantiating channel, queue or exchange with wrong object, then using it 1.0.4 Release: * 62549: Fixing broken persistent connection * 62412: Fixing segfault due to destruction order * 62411: Fixing declaration overload bug * 62410: Fixing declaration overload for 5.4 * 61337: Adding License file * 61749: Fixing handling for binary content in envelope * 62087: Adding appropriate version information * 62354: Enabling debugging dumping of objects * 61351: Updating min PHP version requirements to 5.2.0 1.0.3 Release: * Fixing compilation issue with PHP 5.4 1.0.2 Release: Fixed bug: * Memory leak when using AMQPQueue::get from a queue with no messages 1.0.1 Release: Fixed bug: * 61247: Allow queue creation with empty queue name, and return auto generated name * 61127: Segmentation fault when cleaning up an AMQPChannel without calling AMQPConnection::connect first 1.0.0 Release: Changed/finalized API signature: * Exposing AMQPChannel * Exposing AMQPEnvelope * Exposing more queue and exchange arguments and flags * Exposing basic.qos Added persistent connections Cleaned up codebase Fixed memory leaks and segmentation faults 0.3.1 Release: Fixed bug: * 24323: Cannot get the name for auto-named reply-to queues 0.3.0 Release: Fixed memory leaks in many functions (courtesy Jonathan Tansavatdi and Andy Wick) Fixed consume method to return proper values Cleaned up variable usage Fixed bugs: * 22638: Unexpected exit code 1 with AMQPQueue::consume() * 22698: AMQPQueue::consume 0.2.2 Release: Made extension compatible with PHP lt 5.3 (courtesy John Skopis) Fixed wrong typing of message properties (courtesy John Skopis) 0.2.1 Release: Fixed refcount decrementing bug causing segfaults. 0.2.0 Release: Works with AMQP 0-8 and 0-9-1 (used by RabbitMQ 2.*) Modified AMQPConnection object: * Requires call to 'connect' method to connect (no longer connects on instantiation) * Added support for disconnect and reconnect * Added helper setters for port, host, vhost, login and password Improved consume method to block for MIN messages, and try to get MAX messages if available Fixed zval descoping bugs Fixed bugs: * 17809: Couldn't compile pecl extension under PHP 5.3 * 17831: Segmentation fault when the exchange doesn't exists * 19707: AMQPQueue::get() doesn't return the message * 19840: Connection Exception

  • pcsc 0.3.1 Fixed bug to make the use of the T=0 protocol possible.

  • xdebug 2.2.7 Thu, Jan 22, 2014 - xdebug 2.2.7 = Fixed bugs: - Fixed bug #1083: Segfault when requesting a variable for a context that did not have them. - Fixed bug #1087: zend_execute_script or zend_eval_string in RINIT segfaults. - Fixed bug #1088: Xdebug won't show dead and not executed lines at the second time. - Fixed bug #1098: Xdebug doesn't make use of __debugInfo. - Fixed segfaults with ZTS on PHP 5.6.

0 comments voice your opinion now!



Community News:
php[tek] 2015 Schedule Announced
January 26, 2015 @ 13:43:50

php[architect] has just announced the full schedule for their upcoming php[tek] conference happening in May (18th-22nd) in Chicago, Illinois.

php[tek] is a PHP conference like no other: it brings together great technology content and great people and mixes them up in a wonderful cocktail of PHP fun. We like to think of php[tek] as a professional conference with a community flair. You will find a high-quality presentations by the brightest experts in the PHP world, coupled with a welcoming and friendly community of attendees and speakers.

Sessions at this year's event cover a wide range of topics including:

  • Managing Dependencies with Composer
  • A Toolbox for APIs and Integrations
  • MySQL Replication for Beginners
  • Testing as Regression Prevention
  • Navigating Your Git Repository
  • Dependency Injection, Dependency Inversion, and You
  • Impostor Syndrome and Individual Competence

You can pick up your tickets for the event directly from the main conference website.

0 comments voice your opinion now!
phptek15 tek15 conference schedule announcement

Link: http://tek.phparch.com/schedule/

Paul Jones:
MVC and ADR are User-Interface Patterns, Not Application Architectures
January 26, 2015 @ 11:51:26

In response to a recent post from Anthony Ferrara about MVC Paul Jones suggests that Anthony's view that it and related structures "all pretend to be application architectures" is false.

The central mistake I think Anthony makes is near the end of this post, where he states (in talking about MVC, ADR, et al.) that "All Pretend To Be Application Architectures." That assertion strikes me as incorrect. While it may be that developers using MVC may mistakenly think of MVC as an application architecture, the pattern description itself makes no such claim. Indeed, Fowler categorizes MVC as a "Web Presentation Pattern" and not as an "Application Architecture" per se. [...] Fowler's categorization and description of MVC define it pretty clearly as a user interface pattern. ADR, as a refinement of MVC, is likewise a user interface pattern.

He goes on to talk more about the ADR (Action-Domain-Responder) pattern, how it's more of a user interface pattern as well and how that relates to using it for HTTP requests. He suggests that the definition from Anthony may be a bit too broad and proposes the alternative "All Are User Interface Patterns, Not Entire Application Architectures" to be a bit more specific.

0 comments voice your opinion now!
opinion adr actiondomainresponder mvc modelviewcontroller deisgnpattern userinterface

Link: http://paul-m-jones.com/archives/6079

Coder on Code:
Design Patterns in PHP Adapters
January 26, 2015 @ 10:46:42

The Coder on Code site has posted a new tutorial covering the Adapter design pattern in detail. They talk about what the pattern is, what it can be useful for and include some code to illustrate.

The adapter pattern also referred as the wrapper pattern, I find that wrapper is a more fitting name since it describes clearly what this pattern does; it encapsulates the functionality of a class or object into a class with a common public interfaces. [...] Adapters are one of the easiest patterns to comprehend and at the same time one of the most useful ones.

He starts with some of the basic definitions of terms involved in the pattern: client, adapter and adapteee. His example centers around a notification manager class that lets you switch types between Twitter, Email and SMS messaging. His initial code has all of the message types handled in one class method. He shows how to refactor this out to an interface and a set of child classes, each with the corresponding handling in a "sendNotification" method. These are then used by an adapter in the main class to send the given message. This simplifies the main messenger class and contributes to the overall improvement of architecture and testability of the application.

0 comments voice your opinion now!
designpattern adapter example introduction client adapter adaptee messaging tutorial

Link: http://coderoncode.com/2015/01/25/design-patterns-in-php-adapters.html


Community Events





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


api symfony introduction install voicesoftheelephpant release composer series version podcast configure language interview community unittest opinion list conference extension laravel

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