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

Cloudways Blog:
Create A Contact Form In Laravel That Sends You An Email
Jun 23, 2017 @ 11:17:02

On the Cloudways blog they've posted a tutorial showing you how to create a simple contact form that emails when someone fills it out and the information they submitted.

Laravel is well known for providing multiple solutions for a problem. This is one of the main reasons of the popularity of the framework. Popular Laravel solutions cover routine functionality such as authentication, sessions, routing, and caching.

Contact Us forms are another routine functionality that is a requirement of more or less every website. In this article, I am going to demonstrate how you can easily create a contact form in Laravel with email. To understand the functionality of Laravel mail function. I suggest you read my previous article on sending emails in Laravel.

The author then walks you through the installation of a new Laravel application on the Cloudways service. He then shows how to install the "Form" package (laravelcollective/html) and enable it as a service provider. Next up comes the database configuration and the creation of the table to handle the data submitted via the "Contact Us" form. The model is then created to work with the table, the route is added to show the form (and handle the submission) as well as the matching view and controller. The post wraps up with the commands and configuration you'll need to send the emails and an example of a "mailable" class to handle the email's construction.

tagged: tutorial laravel contact form email simple

Link: https://www.cloudways.com/blog/laravel-contact-form/

9Lessons.info:
Ionic 3 and Angular 4: PHP Restful API User Authentication for Login and Signup
Jun 23, 2017 @ 10:32:17

On the 9Lessons.info site they've posted a tutorial walking you through the creation of an application using Iconic 3, Angular 4 and a PHP restful API and how to handle user authentication and signup. It's a continuation from this previous post that kicked off the series.

Today’s post explains how to implement login authentication system for your AngularJS applications. It will show you how to log in with a user and store the user session, so it deals with token based authentication. Since we are using token based authentication, it protects if any unauthorized request is made and notices for a new login if required. This makes your application’s authentication to be more secured compared with any other authentication system. Every user details will be stored in an external database and a PHP based API is used in the backend for handling this authentication. Hope you’ll find it more easily using this as your authentication system in your AngularJS projects.

They assume you've worked through the previous post and already have the basic structure of the application set up. They share a screencast showing the process but also include the key details - database tables, code and markup - in the post for those that prefer to follow along that way.

tagged: tutorial 9lessons iconic angularjs restful api user authentication signup

Link: http://www.9lessons.info/2017/06/ionic-angular-php-login-restful-api.html

The Bakery:
Welcoming Phinx to the CakePHP family!
Jun 23, 2017 @ 09:54:02

On The Bakery (the CakePHP site) an official announcement has been posted welcoming Phinx to the CakePHP family. The Phinx library is a popular tool for framework-agnostic database migration handling.

We are very excited to announce that Phinx has joined the CakePHP team. The Github project has already been moved to the CakePHP organisation. The project itself will stay MIT-licensed but be gradually transformed into a Cake Software Foundation project. Other great news is that the current way to install and update Phinx remains unchanged.

As you are aware, CakePHP has been using Phinx since 3.0.0 for database migrations. The CakePHP Core team welcomes the opportunity to look after and maintain the project and will now start making changes to bring the code in line with the CakePHP (our) coding standards. As well as cleaning up issues and PR’s soon. We will be following up with our plans for the code and setting roadmaps in the coming weeks.

Rob Morgan, the original author of the library has also added some of his own commentary in a post to his site:

I’ve been busy lately. Juggling startups and open source work is no easy feat. I managed to do it for the past 5 years, but beyond 30 its proving to be more difficult. Phinx is not accelerating at the pace I’d like it to be. In fact so far this year we’ve only managed to ship 6 releases. I decided that the best strategy moving forwards is to find a new home for Phinx. One that has an active and loyal community and one that delivers great software. I’m pleased to announce that I’ve found the right fit.

He points out that the only real thing changing for now is the location of the repository. He looks back on the journey that got him and the project to where it is today and how much the support from the PHP community meant during that time.

tagged: cakephp phinx database migration robmorgan library project foundation

Link: https://bakery.cakephp.org/2017/06/23/welcoming-phinx-to-the-cakephp-family.html


Zend Developer Zone:
June 2017 PHP Community (coffee) Cup of Service winner
Jun 22, 2017 @ 12:29:42

The Zend Developer Zone has announce their "Coffee Cup of Service" winner for the month of June 2017: Sara Golemon.

It is time for the June 2017 PHP Community (coffee) Cup of Service award. This month it goes to someone who has been giving to PHP for more than 15 years, Ms. Sara Golemon.

Sara is a regular speaker at PHP conferences worldwide, an active core contributor, [and] one of the release managers of PHP 7.2.

Please join us here at Rogue Wave in saying thank you to Sara for her more than fifteen years of service to PHP and the PHP community.

This is the second winner of the "Coffee Cup of Service" winner with the first being Michelangelo van Dam himself who the award was inspired by.

tagged: coffeecupofservice winner saragolemon zend roguewave community

Link: https://devzone.zend.com/category/community/

Voices of the ElePHPant:
Interview with Heather White (2)
Jun 22, 2017 @ 11:42:03

The Voices of the ElePHPant podcast, hosted by community member Cal Evans, has posted their latest episode interviewing a member of the PHP community. In this latest show Cal welcomes back Heather White of All For One events. Unfortunately, due to recording conditions the audio on this episode is muffled at some points but the content is as great as always.

They talk about her presentation at CakeFest 2017 in New York City about stepping outside of your "comfort zone" and get up and present what you've learned (teaching). They also discuss mentorship and what can be done to become a mentor to those in your company, group or community. They also discuss how the overall community can help to train up the next "generation" of developers. They also mention the Coder Cruise conference, the speakers that'll be presenting and the other activities that will be happening on the cruise for families of attendees.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 for listening at your leisure. If you enjoy the show be sure to subscribe to their feed and follow them on Twitter to get the latest updates on new shows as they're released.

tagged: voicesoftheelephpant community interview heatherwhite podcast

Link: https://voicesoftheelephpant.com/2017/06/21/interview-with-heather-white-2/

Marco Perone:
Maybe in PHP
Jun 22, 2017 @ 10:35:16

In a recent post to his site Marco Perone looks at the idea of "maybe" in PHP, having functionality that acts a default value if no value is present. This idea is implemented in other languages like Haskell and Elm.

Doing functional programming in a language as PHP, which is almost completely used as an imperative or object oriented way, is not always easy. Good progresses have been made thanks to the introduction of callable type hints in PHP 5.4 and the diffusion of functional interfaces like the ones present in PSR-7.

Still, all “good” PHP code is still written using objects and classes and the object oriented perspective on the world strongly influences even the most functional oriented libraries.

In this post I would like to propose as an example how we could implement the Maybe type in PHP. We will see how some open source libraries do this, we will see an alternative solution and we will raise concerns about some modelling issues.

He starts off by describing what the "maybe" functionality is and gives some examples of it in use in other languages. He points out that while there's several PHP libraries that implement this kind of default handling, it's not in the PHP core language. He works through some of these libraries and shows them in use: monad-php, Phunkie, php-maybe-monad and php-fp-maybe. He wraps up the post showing his own suggested implementation and how it could help resolve some of the issues he found with the other libraries as he worked through them.

tagged: maybe language default variable functional tutorial library

Link: http://marcosh.github.io/post/2017/06/16/maybe-in-php.html

PHP.net:
PHP 7.2.0 Alpha 2 Released
Jun 22, 2017 @ 09:12:12

The PHP.net site has announce the latest alpha release for the upcoming PHP 7.2.0 release: PHP 7.2.0 Alpha 2:

The PHP development team announces the immediate availability of PHP 7.2.0 Alpha 2. This release contains fixes and improvements relative to Alpha 1. All users of PHP are encouraged to test this version carefully, and report any bugs and incompatibilities in the bug tracking system.

[...] For information on new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive.

As these are just development releases, the downloads for them are on the QA sites: source packages and Windows binaries. The final alpha for PHP 7.2.0 (third) will be published July 6th. Next comes the beta stage then Release Candidates. You can see the full release schedule plan here.

tagged: language alpha release php72 download

Link: http://php.net/index.php#id2017-06-22-1


SitePoint PHP Blog:
What Is Snapshot Testing, and Is It Viable in PHP?
Jun 21, 2017 @ 12:28:01

On the SitePoint PHP blog they've posted another article from author Christopher Pitt. This time he talks about snapshot testing and if it's a viable way to evaluate code in PHP applications.

Ah-ha moments are beautiful and rare in programming. Every so often, we’re fortunate enough to discover some trick or facet of a system that forever changes how we think of it. For me, that’s what snapshot testing is.

You probably write a lot of PHP code, but today I want to talk about something I learned in JavaScript. We’ll learn about what snapshot testing is and then see how it can help us write better PHP applications.

He starts with a brief introduction to the technology to be used (React in Javascript) and how it could be recreated in PHP. He then covers testing interfaces, evaluating the correct functionality of frontends via various testing tools. He includes some examples of this kind of testing and how it can help a developer mentally break up functionality into components. From there he switches over to the PHP side, introducing the spatie/phpunit-snapshot-assertions package and showing how to use it to check the make up of a snapshot and test several assertions that should exist.

tagged: snapshot testing viable javascript frontend assertion tutorial

Link: https://www.sitepoint.com/snapshot-testing-viable-php/