News Feed
Sections




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

SitePoint PHP Blog:
Drupal 8 Hooks and the Symfony Event Dispatcher
October 21, 2014 @ 13:14:53

The SitePoint PHP blog has a new tutorial posted today showing the interaction between Drupal 8 hooks and the Symfony dispatcher in the last part of their series showing how to build a custom Drupal 8 module.

With the incorporation of many Symfony components into Drupal in its 8th version, we are seeing a shift away from many Drupalisms towards more modern PHP architectural decisions. For example, the both loved and hated hook system is getting slowly replaced. Plugins and annotations are taking away much of the need for info hooks and the Symfony Event Dispatcher component is replacing some of the invoked hooks. Although they remain strong in Drupal 8, it's very possible that with Drupal 9 (or maybe 10) hooks will be completely removed.

He starts off with a brief introduction to what the event dispatcher is and how it currently interacts with the Drupal 8 system. He uses a simple form example with two text fields and how to hook in the dispatcher to fire a "demo_form.save" event when the user submits the form. He ties this into a DemoEvent and sets up a simple subscriber. He ends the article with a look at using hooks to achieve the same kind of goal.

0 comments voice your opinion now!
drupal8 tutorial hooks event dispatcher symfony component

Link: http://www.sitepoint.com/drupal-8-hooks-symfony-event-dispatcher/

NetTuts.com:
Building Advanced Email Features With IMAP and PHP
October 21, 2014 @ 12:19:47

On the NetTuts.com site they've posted a tutorial showing you how to build advanced features with IMAP and PHP. He bases it on the SimplifyEmail project and incldues examples of three different features to get you started.

Analysis of my own email showed I was receiving email from more than 230 automated senders, far fewer actual people. I was tired of constructing filters in Gmail and filling in a myriad of unsubscribe forms. I wanted to have more control over managing my email and simplifying my life. Finally, this past year, I decided to build the features I needed. The result is Simplify Email (SE), a small web app you can host yourself which offers a variety of cool new email features all of which you can check out on the project website. The coolest thing about SE is that it's a platform for reading, analyzing, routing and managing your email - the possibilities abound. Simplify Email is essentially a programmable playground for "hacking" your own email.

His three examples show you how to:

  • Checking your inbox and filter messages
  • Implement a Whitelist challenge to unknown senders
  • Reporting unanswered email

Each of these comes with plenty of code examples, screenshots and output examples (as well as some places where you might need to change some SE configuration values).

0 comments voice your opinion now!
advanced email imap tutorial feature simpleemail filter whitelist reporting

Link: http://code.tutsplus.com/tutorials/building-advanced-email-features-with-imap-and-php--cms-22059

Anthony Ferrara:
Educate, Don't Mediate
October 21, 2014 @ 11:53:55

In his latest post Anthony Ferarra makes a suggestion about teaching developers how to solve problems via a "quick fix" versus educating them about the real problem: educate, don't mediate.

Recently, there has been a spout of attention about how to deal with eval(base64_decode("blah")); style attacks. A number of posts about "The Dreaded eval(base64_decode()) - And how to protect your site and visitors" have appeared lately. They have been suggesting how to mitigate the attacks. This is downright bad. The problem is that these posts have been suggesting things like "Disable eval()" and "Disable base64_decode()" as possible solutions. And while technically that would work, it completely misses the point, and does nothing to protect users

He suggests that developers shouldn't just look for a "quick fix" solution posted in a tutorial somewhere and go on their merry way. One danger in this is that those instructions could only be patching part of the problem, not all of it. In this case, the disable eval/base64 handling is only a code-level fix. If this exploit exists in your application, the attacker was able to get to the local file system - a much bigger problem.

0 comments voice your opinion now!
educate mediate opinion bugfix quickfix eval base64 encode decode

Link: http://blog.ircmaxell.com/2014/10/educate-dont-mediate.html

Phil Sturgeon:
PHP Wars Attack of the Clones
October 21, 2014 @ 10:18:02

In one of his recent posts Phil Sturgeon talks about what he calls the "Attack of the Clones" on Packagist. In this case, he's referring to the number of packages that all pretty much do the same thing, just in slightly different ways.

n the last article I said I wanted to write about when its a good idea to release a component. A lot of this comes down to: is there one out there that does what I want, and if so, can I use it. This blog post is going to touch on a lot of points already made well by Anthony Ferrera. His article Reinvent The Wheel! says many of the same things, so if you only have time to read one article right now, go and read that. I've been talking with various people on Twitter about how I see a lot of people building what I consider to be clones. [...] It should go without saying that I'm not trying to quash innovation; I just don't think building identical shit over and over again is innovation. I see people wasting their time, and I know that time could go to better use.

He talks about how he's not opposed to innovation and development for the sake of learning, but that often the packages released are lower-powered versions of already established, well-tested packages. These kinds of packages can clutter the results when the packages are searched and prevent developers from finding the best fit for what they need. He mentions frameworks, but doesn't dwell on them as they're a bit more "self-contained" than just packages. He also touches on the curation of packages (guiding people to the right ones) as a possible solution and looks at how some of the other communities out there handle this same problem.

0 comments voice your opinion now!
clones package opinion curation learning innovation community

Link: https://philsturgeon.uk/blog/2014/10/php-wars-attack-of-the-clones

Voices of the ElePHPant:
Interview with Ross Tuck
October 21, 2014 @ 09:27:18

The Voices of the ElePHPant podcast has released its latest community interview, this time with Ross Tuck, well-known PHP speaker and community member.

In this episode Cal and Ross talk about the speaking he does at conferences and various events. They talk about how developers can make the jump into speaking and how it's a way to "give back" to the community. They also talk about Ross' decision to move to the Netherlands and the community that's coming from that area. Finally, they talk about his wide range of conference types.

You can listen to this latest show either through the in-page audio player or by downloading the mp3. If you enjoy the interview, be sure to subscribe to their feed.

0 comments voice your opinion now!
voicesoftheelephpant rosstuck community interview speaking

Link: http://voicesoftheelephpant.com/2014/10/21/interview-with-ross-tuck/

Community News:
Packagist Latest Releases for 10.21.2014
October 21, 2014 @ 08:07:51

Recent releases from the Packagist:
0 comments voice your opinion now!



Community News:
Latest PECL Releases for 10.21.2014
October 21, 2014 @ 07:07:59

Latest PECL Releases:
  • pq 0.5.2 * Support PostgreSQL 9.0 and up * Make JSON support optional

  • pecl_http 2.1.3 * Fix build with libcurl < 7.26 (Remi)

  • uopz 2.0.6 fix builds with >= 50600 (zend_is_true changes)

  • pq 0.5.0 + Published documentation at http://devel-m6w6.rhcloud.com/mdref/pq + Added pqConnection::$params + Added pqConnection::declare(), pqConnection::declareAsync() and pqCursor + Added pqConnection::unlisten() and pqConnection::off() + Added pqConnection::$defaultFetchType, pqConnection::$defaultTransactionIsolation, pqConnection::$defaultTransactionReadonly and pqConnection::$defaultTransactionDeferrable + Added pqConnection::$defaultAutoConvert and pqResult::$autoConvert + Added pqResult::CONV_BOOL, pqResult::CONV_INT, pqResult::CONV_FLOAT, pqResult::CONV_SCALAR, pqResult::CONV_ARRAY, pqResult::CONV_DATETIME, pqResult::CONV_JSON and pqResult::CONV_ALL + Always declare pqTypes OID constants + Added pqResult::fetchAllCols() - Reverse arguments of pqResult::fetchCol() - Attempt to access properties of objects that have not been initialized by its constructor will throw E_RECOVERABLE_ERROR - Renamed pqConverterInterface to pqConverter - Added second argument "$type" to pqConverter::convertFromString() and pqConverter::convertToString() * Fixed wakeup of persistent connections to ping the server with an empty query and eventually reset the connection * Fixed possible invalid free and leak * Fixed a possible crash

  • pq 0.5.1 + Fixed build with PostgreSQL <= 9.2

0 comments voice your opinion now!



SitePoint PHP Blog:
PHP and RabbitMQ Advanced Examples
October 20, 2014 @ 14:19:33

On the SitePoint PHP blog Miguel Ibarra Romero continues his series looking at the use of RabbitMQ with PHP in part two. He builds on the code (and setup) from the first part of the series and gets into some more advanced examples this time.

In part 1 we covered the theory and a simple use case of the AMQP protocol in PHP with RabbitMQ as the broker. Now, let's dive into some more advanced examples.

The remainder of the post includes two examples of more advanced operations:

  • Example 1: send request to process data asynchronously among several workers
  • Example 2: send RPC requests and expect a reply

Each example includes a diagram of the overall flow of the process, the code to make it happen both for the sender and receiver.

0 comments voice your opinion now!
rabbitmq advanced example tutorial series part2

Link: http://www.sitepoint.com/php-rabbitmq-advanced-examples/

NetTuts.com:
Design Patterns The Facade Pattern
October 20, 2014 @ 13:17:46

NetTuts.com has continued their series covering common design patterns and their implementation in some example PHP scripts today. In their latest post they focus on the Facade pattern, a member of the "structural" family of patterns.

When it comes to design patterns, you may have questions: Why should we use design patterns in programming? Our code can work just fine without it. [...] Code that employs design patterns is easy to understand, easy to maintain, and easy to extend.[...] In this tutorial, we are going to cover the facade design pattern. It falls under the category of structural patterns because it deals with how your code should be structured to make it easily intelligible and keep it well maintained in the long term.

They start with a UML layout of a typical Facade and include a typical problem/solution where it could be used. They get into a code example that creates a simple checkout process. In this process, they use the Facade pattern to create a more maintainable, extensible ordering workflow.

0 comments voice your opinion now!
designpattern facade introduction tutorial uml series

Link: http://code.tutsplus.com/tutorials/design-patterns-the-facade-pattern--cms-22238

Qandidate.com Blog:
Using the Accept Header to version your API
October 20, 2014 @ 12:56:46

On the Qandidate.com blog today there's a new tutorial talking about the use of the Accept header in REST HTTP requests and, more specifically, working with it in a Symfony-based application.

I investigated different ways to version a REST API. Most of the sources I found, pretty much all said the same thing. To version any resource on the internet, you should not change the URL. The web isn't versioned, and changing the URL would tell a client there is more than 1 resource. [...] Another thing, and probably even more important, you should always try to make sure your changes are backwards compatible. That would mean there is a lot of thinking involved before the actual API is built, but it can also save you from a big, very big headache. [...] Of course there are always occasions where BC breaks are essential in order to move forward. In this case versioning becomes important. The method that I found, which appears to be the most logical, is by requesting a specific API version using the Accept header.

He shows how to create a "match request" method in his custom Router that makes use of the AcceptHeader handling to grab the header data and parse it down into the type and API version requested. He also includes an example of doing something similar in the Symfony configuration file but hard-coding the condition for the API version by endpoint.

0 comments voice your opinion now!
accept header rest api versioning symfony tutorial

Link: http://labs.qandidate.com/blog/2014/10/16/using-the-accept-header-to-version-your-api/


Community Events





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


release introduction package bugfix podcast framework deployment install library api unittest opinion voicesoftheelephpant laravel community series interview zendserver language symfony

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