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

Hari KT:
Zend Feed and Guzzle
April 02, 2015 @ 10:43:06

Hari KT has posted some of the results of his work integrating the Guzzle client into the Zend Feed component for use in handling it's HTTP requests and responses.

You may have worked with Zend Feed as a standalone component. I don't know whether you have integrated Zend framework Feed with Guzzle as Http Client. This post is inspired by Matthew Weier O'Phinney, who have mentioned the same on github.

He starts with the contents of his composer.json configuration file, pulling in Guzzle, ZendFeed and ZendService, and explaining the need for each. He then makes a simple "GuzzleClient" class and "GuzzleResponse" class that fit with the needed interfaces used by ZendFeed. Then he "wires them up" and injects the custom client and responses classes into the ZendFeed instance.

0 comments voice your opinion now!
zendfeed component guzzle integrate http client interface tutorial

Link: http://harikt.com/blog/2015/04/01/zend-feed-and-guzzle/

ServerGrove Blog:
Symfony2 components overview Stopwatch
March 17, 2015 @ 11:12:40

The ServerGrove blog has returned with another of their overviews of a specific Symfony2 component. In this new article they talk about the Stopwatch component, a useful way to help in profiling execution of your application.

It's been a long wait, but we are back again with the Symfony2 components series. In the 12th post of the series, we cover the Stopwatch component. Even though is one of the smallest ones, that does not mean is not important, as plays a crucial role when we want to profile our code.

Since the article series is about working with the component individually, they show you how to get it installed via Composer by itself. They include a simple example of it in use, starting/stopping a "test" timer, getting the duration and getting the overall memory consumption. They also include a slightly more complex example timing the execution of a Fibonacci sequence, reporting back the execution time on each line of output. The article also covers other features like the "lap" method, sections for grouping events and the difficulties you'd have extending it.

0 comments voice your opinion now!
symfony2 component overview stopwatch introduction

Link: http://blog.servergrove.com/2015/03/16/symfony2-components-overview-stopwatch/

SitePoint PHP Blog:
Exploring the Webiny Framework The StdLib Component
March 09, 2015 @ 11:57:47

In this first post in a new series on SitePoint's PHP blog Bruno Skvorc about the Webiny framework and why they chose to "reinvent the wheel" in a lot of their code. In this first post Bruno focuses in on the StdLib component.

We all know there's no shortage of frameworks in the PHP ecosystem, so it surprised me quite a bit to see another pop up rather recently. The framework is called Webiny, and, while packed to the brim with wheel reinventions they deem necessary, there are some genuinely interesting components in there that warrant taking a look. In this introductory post, we won't be focusing on the framework as a whole, but on the most basic of its components - the StdLib.

The StdLib component is responsible for base level functionality including making using scalar variables (as opposed to objects) simpler. It makes use of traits to include its functionality across the board rather than through direct inheritance. He lists some of the features included in the component, various traits for reuse, like the "factory loader" and validator traits. He includes descriptions and code examples of several others as well, showing them in use and some of their limitations too.

0 comments voice your opinion now!
webiny framework series stdlib component part1

Link: http://www.sitepoint.com/exploring-webiny-framework-stdlib-component/

Web Mozarts:
Resource Discovery with Puli
January 15, 2015 @ 11:14:53

Bernhard Schussek has written up a new post to the Web Mozarts blog talking about resource discovery with Puli. Puli is a management tool for the non-PHP files in your applications (CSS, Javascript, YAML, etc). In this post he talks about the use of the discovery component and its use of resource binding.

Many libraries support configuration code, translations, HTML themes or other content in files of a specific format. The Doctrine ORM, for example, is able to load entity mappings from special XML files. When setting up Doctrine, we need to pass the location of the *.dcm.xml file to Doctrine's XmlDriver. That's easy as long as we do it ourselves, but what if someone else uses our package? How will they find our file? What if multiple packages provide *.dcm.xml files? How do we find all these files? We need to remove the appropriate setup code after removing a package [and] we need to adapt the setup code after installing a new package. Multiply this effort for every other library that uses user-provided files and you end up with a lot of configuration effort. Let's see how Puli helps us to fix this.

He talks about the concept of package roles in the tool, breaking them down in resources and providers. He then shows how Puli makes it possible to discover resources by defining a type via Puli and the code for the discovery process. He then binds the XML configuration definition and executes a "find" to ensure it's configured correctly. Finally, he shows the process to use Puli in this Doctrine example allowing it to locate and use the XML mappings dynamically via a custom driver.

0 comments voice your opinion now!
puli resource discovery dynamic doctrine component

Link: http://webmozarts.com/2015/01/14/resource-discovery-with-puli/

Joshua Thijssen:
Debugging Symfony components
January 02, 2015 @ 09:44:53

Joshua Thijssen has a quick new post today talking about debugging Symfony components, sharing a simple but useful hint.

Don't you hate it when you are stepping through your debugger during a Symfony application debug session, and all of a sudden it cannot find files anymore as Symfony uses code located in the bootstrap.php.cache instead of the actual Symfony component. Symfony creates these cache-classes in order to speed up execution, but it makes that xdebug cannot find the correct code to step through anymore.

He found a solution in a few changes to his "app_dev.php" bootstrap file to alter the location of the autoloader and disable cache loading. This prevents issues with Symfony trying to access cached versions and use the actual files and locations, making debuggers much more happy.

0 comments voice your opinion now!
debug symfony component tip cache disable dev

Link: https://www.adayinthelifeof.nl/2014/12/31/debugging-symfony-components/

Phil Sturgeon:
Composer It's ALMOST Always About the Lock File
November 05, 2014 @ 11:44:49

In his latest post Phil Sturgeon talks about a point that's been argued on both sides of the Composer users out there - whether or not to commit the "composer.lock" file. Phil talks some about it in his article and suggests that you should commit it for applications but not for components.

If you and your employees are a little vague with your composer.json specifications and you don't have a composer.lock then you can end up on different versions between you. Theoretically, if component developers are using SemVer and you're being careful then you should be fine, but keeping your lock in version control will make sure that the same version is on your dev teams computers. This will happen every time you run $ composer install. If you are on Heroku or EngineYard then this will be used for the deployment of your production components as a built in hook, which is awesome.

He mentions an article from Davey Shafik, this being his reaction to it. He suggests, though, that an absolute of "always commit for components" may be too much and could potentially cause other problems. He points out that since the "composer.lock" handling is local to the directory, you can hit up against version requirement issues between them in your application as a whole. He wonders "how strict is too strict" when defining dependencies and some things to think about (like your users) when making the choice to upgrade the libraries you use.

0 comments voice your opinion now!
composer composerlock file commit version semanticversioning semver component application

Link: https://philsturgeon.uk/blog/2014/11/composer-its-almost-always-about-the-lock-file

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/

Joshua Thijssen:
Deepdive into the symfony2 security component part 1
October 20, 2014 @ 10:26:33

On the latest post on his site Joshua Thijssen has kicked off a series taking a deep dive into the Symfony security component, a key piece in the security of Symfony-based applications. In this first part of the series he introduces the component and starts in on some of the features it offers.

Once in a while I like diving into code and see how things work under the hood. And as the symfony2 framework consists of many different components, bundles and bridges, there is a lot to discover. But ultimately, the code itself mostly isn't really as complex as it might seem from the outside world: just like a good magic trick, once unraveled, it all seems very simple and makes sense.

However, this is not true for one of those components: the security component. This black box full of dark magic doesn't like to give up its secrets, and after some (miserably) failed attempts, I am trying to unravel it once more in a few blog posts. Either we achieve complete victory, or fail yet again.. At this point, I will give both fair odds.

He starts off with an overview of the component, pointing out the two main things is handles: authentication and authorization. He also pulls in a few other things to do with security in Symfony to give a more complete, well rounded picture - the component itself, the security bundle and security bridges. He gets into a bit more detail about this last one and describes their specific use.

0 comments voice your opinion now!
symfony security bundle component overview deepdive series part1

Link: https://www.adayinthelifeof.nl/2014/10/19/deepdive-into-the-symfony2-security-component-part-1/

Dutch Web Alliance:
Technology Choices
October 13, 2014 @ 09:17:07

On the Dutch Web Alliance blog today Stefan Koopmanschap talks about making technology choices, how flexibility comes into play and suggestions on what to do when things go wrong. He uses some of his own experience (and problems) to illustrate his points.

The amount of times I come into an organization that says any of the above is impossible to keep track of on one hand. Or even two. Most development shops for some reason have decided that they have a single tool that will fit the job. Always. I have to admit the current market is good for developers. There are many projects available, and not enough developers or agencies to work on all of them. [...] But too many times have I encountered projects where the used tool actually was not optimal for the project. I would like to make a case against starting with a full stack from the start. Obviously, this approach does not work for all projects, but too many projects start out small but with a full stack. I'm going to take an old project of mine as an example of how to start out small and not grow until you need to.

He talks about the project first, a transcoding tool that used a third-party service and generate a playlist once the process was complete. He shares some of his thinking about the technology involved (Symfony2 without the full Symfony2 stack) and the decision to go with Cilex. He also talks about database choices (PDO over Doctrine) and how starting with small pieces like this makes it easier to change things in the future (or when a roadblock looms ahead). Then comes the "what went wrong" part of the development - debugging the system without the direct access needed to view the logs. Instead he worked around it, made a simple endpoint to show the logs and output it via Twig templates.

The result of all this work, including changes and extensions, was still a very small and lean application that combined the power of the commandline with a simple but effective web interface. I am sure I could have done a similar thing with Symfony2, but the code would've been overkill. [...] It is important to realize that there is not always a need for full stack frameworks or huge CMS'es like Drupal. Sometimes you need to start small and just let it grow.
0 comments voice your opinion now!
technology choice symfony2 fullstack component small pieces

Link: https://dutchweballiance.nl/techblog/technology-choices/

Joshua Thijssen:
Symfony2 logging out
October 10, 2014 @ 10:51:03

In this new post to his site Joshua Thijssen talks about something that's usually considered a common task and might be overlooked when it comes to security: logging out (specifically in Symfony-based applications).

One of the "golden rules" of symfony2 is to never hardcode urls or paths inside your code or templates. And letting symfony deal with the generation of your urls and paths makes your life a lot easier as a developer. But one of the things I see regularly is that people are still hardcoding their logout urls like using "/logout". But logging out is actually a bit more complex than it might seem, and using a simple /logout might work for most cases, but there are better ways to deal with this.

To give some context, he starts with an overview of the Security component of the Symfony framework, mentioning how it can be configured with different "secure" areas and how they handle the user authentication. He includes an example configuration of one of these "firewalls" in a YAML document with three different sections: "dev", "superadminstuff" and "main". He explains what each of these sections are configuring and how they will react when the user visits them. He talks some about the "logout: true" handling and what kind of defaults are also included when it's called. He suggests that, instead of a hard-coded "logout" URL in your application, you make use of the "logout_url" and "logout_path" functions to create the link for you, making it consistent across the application and easier to configure.

0 comments voice your opinion now!
symfony logout security user login component link

Link: https://www.adayinthelifeof.nl/2014/10/06/symfony2-logging-out/


Community Events

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


extension laravel release xdebug series unittest laravel5 language library opinion introduction install interview voicesoftheelephpant php7 api podcast framework example community

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