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

Alex Bilbie:
Looking for a new maintainer of league/oauth2-server
Aug 23, 2017 @ 09:30:16

In a new post to his site Alex Bilbie has started the search for a new maintainer for the league/oauth2-server package citing the lack of time on his part to give the project the time it needs to flourish.

A little over five years ago I pushed the league/oauth2-server. The project has been downloaded over 2.5 million times, has more than 3000 Github stars and has been contributed to by 77 awesome people across some 2000 commits.

Last year when I became self-employed I had intentions that I’d have more time to dedicate towards open source projects but reality worked out slightly differently and I’ve had one of the busiest (and best) years of my life.

He also points out that, besides the lack of time to work on the project, he also doesn't actively use the project himself and wants to find a maintainer that "is/are really impassioned by the project, want to advance the project (for example implement OpenID support) and are willing to devote time to answering support requests and review pull requests."

If this interests you and you'd like to see the project move forward, the post includes his contact information for you to reach out.

tagged: oauth2server phpleague package maintainer request community project

Link: https://alexbilbie.com/2017/08/looking-for-a-new-maintainer-of-league-oauth2-server/

Freek Van der Herten:
A tool to automatically rerun PHPUnit tests when source code changes
Aug 04, 2017 @ 10:12:37

In this post to his site Freek Van der Herten shares information about a tool that can help to streamline your development workflow. The phpunit-watcher tool mimics tools from other languages to watch for changes in the source of your application and automatically execute your PHPUnit tests when modifications are made.

In the JavaScript world Jest, built by Facebook, is an excellent tool to run tests. Not only can it automatically rerun your tests when source code changes, but there’s also an interactive mode where you can set a filter on which tests to run while the tool is running. Would it be great if we could have these awesome features while working with PHPUnit?

Our newly released phpunit-watcher tool provides a Jest like experience. You can simply install it by running composer global require spatie/phpunit-watcher.

Once the tool is installed it can then be run from the command line, sitting and waiting for changes to the target files and directory. It's configurable in case you don't follow some of the usual package directory structures and can be filtered to only run on certain filename matches. This can also be done manually (real-time) via the tool. Screenshots are included showing the tool in action too.

tagged: phpunit watcher automatically execute unittest package

Link: https://murze.be/2017/08/tool-automatically-rerun-phpunit-tests-source-code-changes/

Laravel News:
Track Laravel Model Changes with Laravel Auditing
Aug 04, 2017 @ 09:57:35

On the Laravel News site there's a post sharing a helpful package that can provide an audit trail for model changes, helping you automatically keep track of what changed when.

Laravel Auditing is a Laravel package that aims to make it easy to track eloquent model changes. The documentation describes Laravel Auditing as follows:

"This package will help you understand changes in your Eloquent models, by providing information about possible discrepancies and anomalies that could indicate business concerns or suspect activities.

Laravel Auditing allows you to keep a history of model changes by simply using a trait. Retrieving the audited data is straightforward, making it possible to display it in various ways."

The post talks about another use case for the package - handling versioning for records (like auto-saving a blog post periodically). An example is included showing how to implement the package on the model, show an audit history and a Blade view to show the results.

tagged: laravel model audit package introduction version

Link: https://laravel-news.com/laravel-auditing-package

Laravel News:
Two Best Laravel Packages to Manage Roles/Permissions
Jul 21, 2017 @ 09:48:46

The Laravel News site has posted an in-depth look at two packages Laravel users can implement to add in role/permission management: Bouncer and Laravel-permission.

Roles and permissions are an important part of many web applications. Laravel historically had a lot of packages for them, and improved the core code as well. So what is the situation on this market today? What packages are the best to use? I’ve picked two.

The post starts off by sharing a few reasons why you might even need these packages with the functionality that Laravel already includes. Most of the reasoning comes from the fact that the framework allows for checks but doesn't provide role/permission management. It then gets into what each of the package provide, how to install them and some example code to put them to use. It also looks at the database structure behind them and how they use that to store the authorization data.

tagged: laravel role permission package bouncer laravelpermission introduction tutorial

Link: https://laravel-news.com/two-best-roles-permissions-packages

Matt Stauffer:
What packages do you install on every Laravel application you create?
Jul 19, 2017 @ 12:29:44

On his site Matt Stauffer has a post that asks the readers about the packages they always install for their Laravel applications (and not necessarily just Laravel related packages either).

In preparation for my upcoming [talk](http://customlaravel.com/) at [Laracon 2017](https://laracon.us/), which I'm titling "Custom Laravel," I [asked a quick question](https://twitter.com/stauffermatt/status/885666786036899840) on Twitter to my followers. [...] I wanted to know for my talk, but I was also just curious for my own purposes. Are there any packages I should check out that everyone else already knows about? Here's what I found, in order of the number of recommendations I received...

While most of the packages in his lists (unanimous support, well-loved, etc) are Laravel specific, mostly because of his audience on Twitter, there are some that weren't. These included:

You can check out his full listing in the remainder of the post and a link to another listing from Mike Erickson asking the same kind of question.

tagged: package install laravel application community feedback list

Link: https://mattstauffer.co/blog/what-packages-do-you-install-on-every-laravel-application-you-create

BitExpert Blog:
Mattermost Webhooks and PHP
Jul 19, 2017 @ 10:49:26

On the BitExpert blog Stephan Hochdörfer shares his experience working with Mattermost webhooks and interfacing them with backend PHP scripts. Mattermost is an Open Source Slack clone.

In a recent attempt to automate a few things even more, I was looking for a way to post messages to our [Mattermost](http://mattermost.org/) instance via the [Incoming Webhook](https://docs.mattermost.com/developer/webhooks-incoming.html) feature of Mattermost. I did a quick search on [Packagist](https://packagist.org/search/?q=mattermost) for Mattermost client libraries and as it turns out there a quite a few. I picked the [thibaud-dauce/mattermost-php](https://packagist.org/packages/thibaud-dauce/mattermost-php) package simply because it was the first match.

He then walks through the installation of the package and how it works, using Guzzle, to send messages to the Mattermost service. The incoming request is just a JSON-formatted data set, so it's easily parsed in plain PHP. The output, however, needs to be in a format Mattermost understands. That's where the package comes in, providing a "send" method that allows for the customized text and optional attachment to be sent to the Mattermost server.

tagged: mattermost package webhook messaging message tutorial

Link: https://blog.bitexpert.de/blog/mattermost-webhooks-and-php/

Laravel News:
Bouncer: a Laravel Package for Role and Ability Authorization
Jul 18, 2017 @ 09:23:14

On the Laravel News site there's a new post highlighting a package that can help you enforce roles and permissions in your application, enhancing the existing gates functionality.

Bouncer is an authorization package by Joseph Silber which allows role and ability checks at Laravel’s authorization gate. The package is described as follows: "Bouncer provides a mechanism to handle roles and abilities in Laravel’s ACL. With an expressive and fluent syntax, it stays out of your way as much as possible: use it when you want, ignore it when you don’t."

Bouncer makes it trivial to quickly create roles and abilities with a fluent API that creates them automatically.

The post includes some examples of the library in use, creating roles and abilities with its fluent API and the use of a trait to integrate it into other classes. They also include a bit about how the automatic role creation works and using the functionality in middleware. It also talks about how Bouncer intercepts "can" checks for its own evaluations and how to get all of the abilities for the current user.

tagged: laravel package authorization bouncer tutorial introduction

Link: https://laravel-news.com/bouncer-authorization-package

Freek Van der Herten:
Optimize images in Laravel apps
Jul 17, 2017 @ 09:48:01

In a continuation of his previous post about an image optimization package for PHP Freek Van der Herten covers some refactoring and advancements they've made to the package to make it even easier to use.

A while ago we released image-optimizer. In short this package can make all kinds of images smaller by stripping out metadata and applying a little bit of compression. Read this blogpost to learn more about it. Although it’s pretty easy to work with the package, we felt that we could deliver a more seamless experience in Laravel apps. That’s why we created our newly released laravel-image-optimizer package.

The package uses a bunch of binaries to optimize images. To learn which ones and how to install them, head over to the optimization tools section in the readme of the underlying image-optimizer package. That readme also contains info on <a href="https://github.com/spatie/image-optimizer#which-tools-will-do-what>what these tools will do to your images.

He then includes some code examples putting this new version of the package to work with a Laravel-based application. The examples include replacing the image with an optimized one, saving the optimized one to a new path and resize all images in a request. There's also an example configuration included showing the options you can set to customize your site's image optimization even more.

tagged: optimize image laravel application package tutorial

Link: https://murze.be/2017/07/optimize-images-laravel-apps/

Laravel News:
A Roundup of Laravel Testing Resources and Packages
Jul 12, 2017 @ 09:50:29

On the Laravel News site there's a new post sharing a list of Laravel testing resources and package that you can use for your Laravel-based applications to make testing easier and less work overall.

Testing code is one of the more challenging parts of programming, but luckily Laravel and some other tools are making it easier than ever. Research has even shown implementing a Test-Driven Development (TDD) approach can significantly reduce the number of bugs that make it to production. Testing provides many other benefits, like the freedom to refactor large parts of a system without (as much) fear of breaking things.

With all of the benefits of testing, it’s still challenging to continually test applications. If you are looking to start learning how to test Laravel applications or you want to expand your skills here is a list of great resources to help you.

Included in their list are resources like the official documentation, Laravel Dusk, the Laracasts Laravel Behat extension, the phpspec Laravel extension and Spatie Laravel packages. Each item on the list includes a screenshot, a brief description of the resource/tool and links to get more information about it.

tagged: laravel testing package tool list resource link

Link: https://laravel-news.com/laravel-testing-resources

Freek Van der Herten:
Easily optimize images using PHP (and some binaries)
Jul 07, 2017 @ 10:19:27

Freek Van der Herten has a post on his site sharing a new package that's been developed to help optimize images using some PHP and a few other helpful tools.

Our recently released image-optimizer package can shave off some kilobyes of PNGs, JPGs, SVGs and GIFs by running them through a chain of various image optimization tools. In this blog post I’ll tell you all about it.

He starts off by talking about why they built the package - to make sure the images on their site were as optimized as possible - and what kind of tools are involved in making it work. Those tools are free to use but it does take a little manipulation to ensure the right data is being passed into each. He then gets into the code examples, showing how to optimize an image with just a few lines. The package determines based on the kind of image which optimizing tool to use. He also includes example code showing how to customize the optimization process with extra command line flags. Finally he includes an extra section showing how to integrate it with some of their other packages: the image package, laravel-medialibrary and Browsershot.

tagged: tutorial package optimize image binary imagetype tools

Link: https://murze.be/2017/07/easily-optimize-images-using-php-binaries/