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

Christoph Rumpel:
GroupBy multiple levels in Laravel
Jan 29, 2018 @ 15:35:01

In a post to his site Christoph Rumpel shows the Laravel (well, Eloquent) users out there how to use groupBy at multiple levels for customizing and sorting the results of your database queries.

Since Laravel v5.5.29 you can group collections by multiple levels. Let's see what this means and how this works.

The post starts with some of the current functionality, showing how the groupBy could be used before with a simple collection to group student data by skill level. It then gets into the new functionality, modifying the example to group by both the skill level and by the "teacher" value. The result is a sorted set of results where the top level is the skill level and, inside of each, the teachers with students under that. The post finishes by "going crazy" and showing the grouping by event more criteria, adding "name" and "email" columns to the list.

tagged: groupby group database multiple level laravel eloquent tutorial

Link: https://christoph-rumpel.com/2018/01/groupby-multiple-levels-in-laravel

Jeff Madsen:
PhpStorm: Tasks & Contexts with Your Git Branches
Sep 26, 2017 @ 14:37:29

On his Medium.com site Jeff Madsen shows you how to use contexts in the PhpStorm IDE to switch between environments or current work using a more streamlined process.

Switching context is a pain.

Not just because you need to mentally switch the complex web of ideas in your head. Think about all the physical files on different git branches you have to remember in order to answer a “quick question about task #123”. [...] PhpStorm has a lot of great context links and shortcuts to help you navigate among all these, but it is still a royal pain whenever you need to put one set of files aside and work in a different area of the codebase.

[...] When I finished something and pushed it up for review if there was even a small request to change a default or label I had to reopen the branch and track down the correct files where the work was done. How could I turn that all into a single, easy step?

Enter Contexts and Tasks!

He starts off by defining what a "context" is in the world of PhpStorm - a group of open files with a name attached - and how they can be created/saved inside the IDE. Next is the idea of "tasks" that help with performing operations and relating them to contexts and groupings of files. He then shows how to switch between tasks related to a certain feature and how to close it out when you're done.

tagged: phpstorm custom task context group file switch tutorial

Link: https://medium.com/@codebyjeff/phpstorm-tasks-contexts-with-your-git-branches-92d9d1c5a34b

Christoph Rumpel:
Build a Telegram group bot in PHP
Mar 06, 2017 @ 19:48:41

Christoph Rumpel has a tutorial posted on his site showing how to create a Telegram group bot using a bit of PHP and the BotMan library.

Working with Facebook Messengers bots is great, but there is one thing still missing: group bots! This is why we will built a little Telegram bot today and use it inside my FantasticBurger group.

First thing to keep in mind here is that a group chatbot can be very different from a 1:1 conversation chatbot. In groups chatbots are often not a direct conversation partner but more a quiet assistant.

He briefly talks about why he created the bot and how to go and set up your own Telegraph bot with a simple first command. He then walks through the set up of the BotMan library and connecting it back to the Telegraph service (via an API call) and a simple handler that returns a "Hi there" message when the bot hears the string "Hello".

tagged: tutorial telegraph bot botman group facebook

Link: http://christoph-rumpel.com/2017/03/Build-A-Telegram-Group-Bot/

Laravel News:
Can Frameworks lead to tribalism among developers
Nov 21, 2016 @ 16:21:50

On the Laravel News site there's a new article posted by Percy Mamedy posing the question: "Can Frameworks lead to tribalism among developers?"

In the modern world of web development, it is common practice to make use of frameworks for building large scale applications instead of starting from scratch. [...] In the PHP world, we have seen the emergence of hundreds of frameworks thanks to a large and dedicated community. Some developers even develop their own framework re-using components and parts of other frameworks thanks to an awesome tool called composer.

[...] As part of an experiment, I wanted to see how my fellow developers would react and to what extent they were willing to go to defend their own frameworks if I praised Laravel as being the best framework out there. [...] As expected, responses were flowing in; some even brutal. Everyone defended their framework of choice with extreme passion and dedication. This has lead me to the conclusion that there is an intense sense of identity and kinship that developers have around their framework of choice.

His results came in from a post he made wondering how fellow developers would react to the statement "Google Trends says it all...Laravel is king." He talks about these results and the obviously relation to tribalism in technology choices and how it binds like people in groups, a common human need.

We all as developers feel this intense love and passion for our tools, it’s part of who we are, and I think it’s what makes our Job so unique; we code because we enjoy to and because we love to.
tagged: framework tribalism developer opinion technology group choice

Link: https://laravel-news.com/2016/11/can-frameworks-lead-to-tribalism-among-developers/

SitePoint PHP Blog:
PHP-FIG Alternatives: The Pros and Cons of Various Visions
Sep 22, 2016 @ 16:10:49

On the SitePoint PHP blog paul Jones has written up some of his own perspective on the PHP-FIG and the work that's currently being done by the group on restructuring to make the group more effective, learning from past issues.

In his article The Past, Present and Future of the PHP-FIG, Larry Garfield gives a whirlwind tour of his impressions of the FIG, from its founding to one of its possible futures. I encourage you to read it in its entirety before continuing.

Herein, I will attempt to address some of the errors and omissions in Larry’s article, and offer two other possible futures for the FIG.

He starts by talking about the largest change the group is working on - the PHP-FIG 3.0 proposal. He compares the vision of this effort to some of the founding goals and principles of the group as documented in various emails and posts from current (and past) members of the group. Paul also talks about the FIG 2.0 workflow, what PSRs were before/after it was introduced and some of the overall impact that these and other PSRs from the group have had on the wider community.

He wraps up the post with a look at two alternatives he's proposing for the group's consideration as a way forward and an alternative to the PHP-FIG v3: independent interop groups and disbanding the PHP-FIG all together.

tagged: phpfig alternative vision opinion history group psr community

Link: https://www.sitepoint.com/php-fig-alternatives-the-pros-and-cons-of-various-visions/

SitePoint PHP Blog:
PHP-FIG, Quo Vadis?
Sep 12, 2016 @ 17:53:20

On the SitePoint PHP blog Deji Akala has written up a post talking about the PHP-FIG - some if its history and its current role in the community.

The Polish writer, Henryk Sienkiewicz, was awarded the 1905 Nobel prize for Literature for his epic novel Quo Vadis, which is a Latin phrase meaning “Where are you going?”. In the face of any dilemma, a brief pause and redefinition of one’s goals may be therapeutic.

The PHP Framework Interoperability Group (PHP-FIG) has come of age. With the acceptance of more PHP Standards Recommendations (PSRs), PHP has attracted further positive attention and admiration of the programming community. PSRs governing coding standards, coding style guides, autoloading, logging, caching and HTTP messages have been accepted.

[...] However, the future isn’t as bright as painted, as a recent ruckus within the organization has thrown its continuing existence under doubt.

The post starts out with some of the origins of the group and how its organized and communicates (with a large part of it being the main mailing list). There's some mention of the successes that the group has had (like PSR-0/PSR-4 that allowed for easier creation of the Composer package manager) as well as some disputes that have risen recently about the goals of the group. the post wraps up with a look at other open source communities, the fact that people don't always "see eye-to-eye" and some of the author's own thoughts about the state of PHP-FIG and its future.

One note here: be sure to read the comments on the post - they help clear up a few misunderstandings in the article's contents and give a wider context to the group and its current state.

tagged: phpfig direction group interoperability standards phpfig3 community psr history

Link: https://www.sitepoint.com/php-fig-quo-vadis/

Evert Pot:
Why PHP-FIG matters
May 18, 2016 @ 17:48:02

There's been quite a bit of drama lately around the PHP-FIG (Framework Interoperability Group) organization in the past few weeks, mostly resulting from an inflammatory situation involving one of the member projects. There's been questions around about the PHP-FIG, its role in the community and how that might change in the future. In this post to his site Evert Pot shares some of his own thoughts about the group and why it still matters.

The PHP-FIG is currently going through some growing pains. I recently resigned as a voting rep, and after some juvenile controversy Lavarel, Doctrine and Propel have as well.

Since its inception 8 years ago, the groups greatest problem has been to properly organize itself. [...] Now as a sort of knee-jerk reaction to these issues, PHP-CDS was setup with a much simpler process. [...] Some good stuff is happening though. A few people are working on a thankless effort to restructure the organization dubbed “FIG 3.0”. (thanks Larry Garfield and Michael Cullum).

He makes some of his own suggestions to the group as to things he think could be "quick wins" and help make the group better overall. He then gets to the "why it matters" section. He uses the PSR-6 caching standard as an example and points out that many other standards were based on successful interfaces on projects - not so much on the caching though. He also talks some about PSR-7 and how request/response handling can "look odd" at first glance. He suggests that while the PSR-7 standard probably evolved from too much discussion, but the PHP-FIG was there to facilitate that discussion. Now they just need to make it easier to get through the process...

tagged: phpfig interoperability important group standards opinion psr7 psr6

Link: https://evertpot.com/why-php-fig-matters/

Matt Stauffer:
Middleware groups in Laravel 5.2
Dec 23, 2015 @ 15:28:31

In the next part of his series spotlighting features in the most recent release of the Laravel framework (5.2), Matt Stauffer continues with a look at middleware groups.

When you are creating a site of any significant size in Laravel, your routes file will often get pretty large. One of the first things I do in a new site is group my routes by logically distinct sections like "admin", "auth", "public". Usually each of these groups get their own set of middleware—admin, for example, gets auth. Maybe the API group gets a different auth middleware, and it might get an API-specific rate limiter or something else.

Laravel 5.2 has introduced something called middleware groups, which are essentially a shortcut to applying a larger group of middleware, using a single key.

He takes his example above and makes an "admin" middleware group that lets you combine individual middlewares into a single callable set. He shows how to update your HttpKernel.php file with the new "auth" group and nest the "web" and "auth" middleware inside. He talks briefly about how this handling has changed from 5.1, pointing out that things without the "web" middleware will not have access to cookies/sessions/CSRF handling. He then includes an example showing how to use this "admin" grouping in your routes, either directly on a route or through a route grouping.

tagged: laravel route middleware group tutorial

Link: https://mattstauffer.co/blog/middleware-groups-in-laravel-5-2

Community News:
A Field Guide to ElePHPants
Dec 02, 2015 @ 15:13:51

If you've been around the PHP community (or language) for any amount of time, you've noticed that the mascot for the language is an elephant. Back in the mid-2000s this mascot made a move into the real world and the first blue elePHPants were released as plush toys. Since then several different groups and companies have produced their own versions with their own colors and logos. There's several of them out there and the Field Guide to ElePHPants site lists them all.

The PHP elephpant, Elephpas hypertextus, was first sketched by Vincent Pontier in 1998. For ten years it was only seen in drawings. The plush elephpant was first sighted in 2007. Since that time a large number of variations have been observed in the wild.

The site covers fun facts about their overall appearance, identification of the generations, their "natural habitat" and how they're distributed. They then list each of the elePHPants including pictures, talking about the origins of each and several that are "coming soon" from other groups/conferences. Some of the elePHPants are more rare than others (like the Gold of which only one was produced) but more and more are coming on the scene all the time, usually as a part of Kickstarter campaigns.

tagged: field guide elephpant color company group

Link: http://afieldguidetoelephpants.net

Community News:
PHP-FIG Website Relaunch
Oct 26, 2015 @ 16:27:30

The PHP Framework Interoperability Group (or PHP-FIG for short) has just released a new version of their website with a great new look and even better organization for the PSR content: http://php-fig.org. They just tweeted about it too:

What do you think of our new website? Slicker, cleaner and easier on the eyes. Give us your feedback! :)

The new version of the site provides sections not only for the details around currently accepted standards but also on current proposals, members of the organization, bylaws and frequently asked questions about the group. They also have links to some resources where you can get involved if you're interested in the group and what they're up to.

tagged: phpfig website relaunch interoperability group redesign

Link: http://www.php-fig.org/


Trending Topics: