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

Symfony Blog:
Symfony website updates #3 - Events
Jul 23, 2018 @ 16:26:38

On the Symfony blog they've posted about an additional update they've made to bring more information to the community: an Events section.

Following the new features we've added in May in the Events & Meetups section, we're pleased to introduce a brand new section within the main website menu: Symfony Events. This will enable you to find a Symfony event near you more easily.

[...] The Events section itself has also been improved, again! We've added a map where you can see at a glance where are organized all the upcoming Symfony events. You can find on the map: all the upcoming official Symfony conferences pinned in red and all the upcoming Symfony community events pinned in blue.

They also added a feature that will automatically pull in Symfony events from the Meetup.com site so there's no need to list them in both places.

tagged: symfony community blog enhancement website events list map

Link: https://symfony.com/blog/symfony-website-updates-3

Fabian Schmengler:
Collection Pipelines in PHP
Dec 28, 2016 @ 18:24:24

In a new post to his site Fabian Schmengler has written up an introduction to collection pipelines and how it could be applied to a Magento-based environment.

If you read the book “Refactoring to Collections” or saw screencasts and talks by Adam Wathan about collection pipelines, but do not work with Laravel, you might have asked yourself how to apply these techniques to other PHP applications, for example Magento.

[...] This is very similar to Unix pipes, where the individual commands are the operations, and the lines passed through input and output stream, the collection.

He starts by illustrating the idea in Bash and Ruby, showing the three main types of collection operations: map, filter and reduce. He talks about the advantages these methods have over traditional looping and what kind of value they can provide in both Laravel and plain old PHP. He illustrates the PHP-only versions using the array_filter, array_map and array_reduce functions and some thoughts on when it's good to use them over normal looping (and when it's not). He then gets into the Magento-specific handling and making use of a package to handle collections: Knapsack. He shows how to use the library to work with collections and, as another option, a "home-grown" version that lives in a single class. The post wraps up with the Magento integration of this functionality, a brief mention of functional programming and "the hard part" of issues with debugging.

tagged: collection pipeline package knapsack magento integration tutorial introduction map reduce filter

Link: https://www.schmengler-se.de/en/2016/12/collection-pipelines-in-magento/

TutsPlus.com:
Programming With Yii2: Using Ajax
Nov 10, 2016 @ 17:18:23

The TutsPlus.com site continues their series covering development with the Yii2 framework in this new article. This time they're focusing in on only the Ajax functionality using it an an example for their startup application interacting with Google Maps to place meeting locations.

In this Programming With Yii2 series, I'm guiding readers in use of the Yii2 Framework for PHP. In this tutorial, we'll explore the implementation of interactive pages using Ajax. Specifically, I'm going to highlight the use of Ajax in two areas of the Meeting Planner application, which I'm writing the Building Your Startup series about in parallel.

The article then starts in on showing you how to load a Google Map into the page using some of the built-in Ajax handling and integrating it into the "Create a Place" form. They show how to collect the information from the map once a location is selected and use this to update a "meeting" record on the backend. All coded needed to reproduce the system is included.

tagged: ajax yii2 framework programming tutorial series google map

Link: https://code.tutsplus.com/tutorials/programming-with-yii2-using-ajax--cms-26663

SitePoint PHP Blog:
Fun and Functional Programming in PHP with Macros
Apr 04, 2016 @ 15:13:37

The SitePoint PHP blog has a new tutorial posted from author Christopher Pitt continuing on his look at macros in PHP (part one is here). In this new tutorial he gets beyond the basic example he provided in part one and recreate some expressive syntax from Javascript and prefixing strings.

I was so excited about my previous article about PHP macros, that I thought it would be fun for us to explore the intersection of macros and functional programming. PHP is already full of functions, with object oriented patterns emerging relatively late in its life. Still, PHP’s functions can be cumbersome, especially when combined with variable scope rules…

[...] It’s not significantly more code [to append the prefix in PHP vs Javascript], but it isn’t as clear or idiomatic as the JavaScript alternative. I often miss JavaScript’s expressive, functional syntax, when I’m building PHP things. I want to try and win back some of that expressive syntax!

He starts with a quick install of the yay library used in the first part of the series. Instead of the manual prefixing from his first example, he creates a macro that uses the array_map handling to generate the necessary code once the pre-compiler has done its job. He then expands on this simpler solution and updates it to allow for the setting of the prefix string. It gets a little complex but he walks through each step of the way, explaining the code that's added and what it expands out to. The result is a map method that generates a bit of code that's eval-ed to handle the prefixing automatically.

tagged: macro series part2 tutorial array map prefix advanced precompile yay library

Link: http://www.sitepoint.com/functional-programming-in-php-with-macros/

DZone.com:
Factory patterns: Collaborators Map
Oct 24, 2012 @ 14:43:02

On DZone.com Giorgio Sironi has a new tutorial looking at the Factory design pattern, specifically the use of a "collaborators map" to create them inside of a dependency injection container.

Like for every library, you should first evaluate if the costs and benefit of integrating [a dependency injection container] are worth it. The alternative is to write your own factory classes, methods and closures: this article explains one of the patterns for building dynamic Factory objects, and as such lowers the cost of the second option. What you know how to do has a lower cost than what you still have to learn, considering risk and implementation time.

He talks about the "old way" of making your own factories to create objects and how the collaborators mapping can replace that. The collaboration mapping is passed in when the object is created and a "create" method is called when the objects (or sub-objects) are needed. He also mentions some of the "easy" and "hard" changes you could make to this setup to expand its functionality.

tagged: factory designpattern collaborator map object create

Link:

PHPRiot.com:
Reducing a Map Path Using Douglas-Peucker Algorithm
Apr 29, 2011 @ 17:40:42

On PHPRiot.com there's a new tutorial showing you how to use the Douglas-Peucker algorithm to make the pathing on your map the simplest possible (the fewer points the better) having serious benefits a wide range of users, most notably those on mobile devices.

When drawing a path on a map (for instance, the directions from point A to point B) it is important to consider the limitations of the device you're drawing the path on. In this article, I will show you how to reduce the number of points in a path so the path can be displayed with minimal loss of quality on devices such as iPhone or Android-powered devices that may struggle with an extremely large set of points.

Using the GTFS service's data, he's been creating maps for an iPhone application. Naturally, a path with 700 points would take a lot of resources to render. Using the Douglas-Peucker algorithm he can reduce it down to a much more manageable 70 points. He explains the algorithm briefly and hows how to implement it in PHP with three classes - ShapePoint, Shape and ShapeReducer. The resulting reduced dataset is then passed directly over to a Google Maps for plotting.

tagged: douglaspeucker algorithm reduce tutorial map point path

Link:

PHPMagazine.net:
Hello PHPUG ?!
Sep 29, 2010 @ 17:02:47

On the PHPMagazine.net site there's a new article about PHP user groups and some of the resources that can be used to help find one in your area.

Part of this community a lot of core developers, documentation editors, web application developers, hackers, Quality assurance team, tons of open source projects, PHP UG around the world, and many many other people contributing each one in its category, and even friends and family! Users Group are an active element of the PHP ecosystem, and I believe that everyone should be involved to contribute and keep these UG active around the world.

Some of the efforts that he's pointed out from the past are the phpgroups.org site, phpusergroups.com as well as the sharemymap.com effort to map the groups out. Unfortunately there's no single resource that you can point to that has a full listing.

tagged: usergroup resource locate map

Link:

SitePoint PHP Blog:
How to Avoid 404s and Redirect Old URLs in PHP
Aug 03, 2010 @ 19:15:27

On the SitePoint PHP blog today there's a new post showing you how to create a 404 page that will redirect people back to the page they're looking for (that used to be there).

It's often necessary to reorganize your site and change the URL structure but, assuming you have similar content, users should rarely encounter a "page not found" error. Producing unnecessary 404 pages is one of my top 10 development mistakes. In this article, we'll create an automated PHP redirection system that converts old URLs to a new address. It's not production code, but it will illustrate the basics so that you can adapt it for your own website.

They walk you through the creation of a 404 error handling PHP page, configuring your server to use it and making the mapping of new URL to old URL. There's even a bit to include if there's not a mapping for a requested page - returning a 301 HTTP header.

tagged: 404 redirect map url tutorial

Link:

Developer.com:
Doctrine: Object Relational Mapping for Your PHP Development
Jun 14, 2010 @ 15:22:06

New on Developer.com today there's a new article looking at one of the more powerful ORM tools available for PHP - Doctrine.

Because of the relational database's pivotal role in driving Web applications, a great deal of time and effort has been put into creating tools that not only simplify the task of mapping database tables to a programming language's object-oriented class structure, but also facilitate the management of your data and schemas over the project lifecycle. [...] The PHP community also has a powerful database integration tool at their disposal: a project known as Doctrine.

They help you get started with this powerful tool by showing you how to get it installed, create a sample schema and loading some fixtures (base data). There's also a quick snippet of code showing you how to grab information from a sample user table and display the name of the user.

tagged: doctrine object relational map orm tutorial

Link:

Zend Developer Zone:
Request parameter mapping to action method parameters
Oct 05, 2009 @ 13:04:54

The Zend Developer Zone has a quick post from albeva about an extension from the default controller in the Zend Framework to map URL parameters directly to the methods.

This not only makes parameter passing intuitive (rather than calling $this->_request->getParam() ) but also automatically uses the default value if provided and if typehinting is provided either via phpdoc comment or before the parameter (array or classname) it will do the required instantiation or type casting.

The post includes a snippet of sample code, but you can learn more about the script here.

tagged: request parameter zendframework map

Link:


Trending Topics: