JavaScript and Underscore.js Type Methods in PHP

I’ve been working with PHP since 2000 and with JavaScript even longer. Over the last decade, JavaScript has evolved drastically. It had a promising design from the very beginning and gained its current incredible shape with the shift to ES2015 (Harmony). PHP, though, didn’t change that much. Apparently, it’s doomed always to suffer from its own legacy. It arrived in the mid-90s as a simple CGI app to maintain Rasmus Lerdorf’s home page and have been more like spontaneously developing ever since. That resulted in syntax inconsistency, a mix of functional and OOP-based assets, and absence of a decent language specification. So every time I switch to PHP I miss the rationality, predictability, and flexibility of JavaScript. This made me consider a library which would bring a JavaScript-like development experience to PHP. Eventually, I came up with Extras, which extends PHP types with JavaScript (other than Underscore) methods, unlocks chaining, and introduces the PlainObject type representing an object-literal.
JavaScript Meets PHP
The library enriches with JavaScript and Underscore.js methods the following PHP types: array (both sequential and associative), string, number (integer, float, NaN), function (callable), collection (Iterable, ArrayObject, Iterator) and boolean. Every added method is a static method of the class representing the type. So we can access any directly, without the creation of a chain like Arrays::map.

Link: https://dzone.com/articles/javascript-and-underscorejs-type-methods-in-php?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Handle Webhooks With Serverless PHP

Did you know you can serverless with PHP? OK, so serverless is clearly not a verb, but since I love serverless tech and have also loved PHP for longer than I’m going to admit (the dates of the earliest posts on my blog might serve as a clue), using these technologies together is definitely my idea of a good time.
I included an example of a serverless endpoint to receive incoming webhooks in my talk at PHPUK and I got a few questions about it so I thought I’d share that example in written form. Serverless makes a lot of sense for API endpoints in general – and also for webhook endpoints since they’re essentially the same thing. Deploying individual functions to the cloud makes the endpoints independent of one another, and serverless platforms scale on demand so if the API calls or incoming webhooks all arrive at once (the reality of the internet is bursty traffic), everything will still work well.

Link: https://dzone.com/articles/handle-webhooks-with-serverless-php?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

VS Code for PHP Development

Although most of my work time is spent on ASP.NET and SharePoint development, I also have some PHP projects. I have my own favorite thin tooling for PHP but I decided to give Visual Studio Code (VS Code) a try with one of the projects. This blog post describes what I have in my dev box and what my first impressions are of using VS Code for PHP development.
Why VS Code?
VS Code is not an IDE like Visual Studio. It is also not a simple code editor with a few commands and syntax highlighting. It sits somewhere in the middle, making it a simple yet powerful tool thanks to the fact that it supports extensions. The main reasons why I considered trying out VS Code for PHP development are:

Link: https://dzone.com/articles/vs-code-for-php-development?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Simple Task Scheduler With PHP

During a more or less large project, a situation may arise when the number of scheduled tasks (cron jobs) becomes so large that their support becomes a DevOps nightmare. To solve this problem, I came up with the idea of creating a PHP scheduler implementation, thereby making it a part of the project, allowing the tasks themselves to be part of its configuration. In this case, the necessary and sufficient number of cron jobs will be equal to one.
Some time ago, I was able to develop a module for event planning. It was just a simplified version of Google/Apple Calendar for users of the application. For storing the dates and rules regarding the repetition of events, it was decided to use the iCalendar format (RFC 5545), which allows one line to describe a schedule for repeating an event, while taking into account the days of the week, months, the number of repetitions, and much more. A few examples:

Link: https://dzone.com/articles/simple-task-scheduler-on-php?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

What’s New in PHP 7.2?: Literally Better Everything

As we all know, most web developers either love or hate PHP with a passion. I’m one of those developers that absolutely love it. I know PHP like the back of my hand. Now, since 7.2 has been released, my love is growing even more! Let’s talk about the awesomeness that the newest version brings to us. Security Is the Most Important Thing Here The 7.2 Release offers some highly needed improvements to security.

Link: https://dzone.com/articles/whats-new-in-php-72-literally-better-everything?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

6 Must-Have Tools in a PHP Developer’s Toolkit

PHP is a popular back-end programming language that allows you to quickly and effortlessly create simple, dynamic websites. It’s so popular, in fact, that around 80% of all websites now use it! Once you’ve decided to learn PHP and join the awesome community…
The post 6 Must-Have Tools in a PHP Developer’s Toolkit appeared first on Treehouse Blog.

Link: http://blog.teamtreehouse.com/6-must-have-tools-in-a-php-developers-toolkit

How to Verify Phone Numbers With PHP, Symfony, and Twilio

In this post, I’m going to demonstrate how to effectively integrate Twilio in a Symfony project by implementing phone number verification. We’re going to discover how to model and validate a user’s phone number, and then use Twilio’s PHP SDK to create a call flow where the user has to enter a 6 digit code to verify themselves. The frontend view will provide a form to capture their number, displaying further instructions or validation errors, and then seamlessly redirect the user to another page once they’ve been verified.
This article does assume you are looking to add Twilio features to your own Symfony project, but if you don’t have one then you can follow this quick tutorial on creating a Symfony 3 project with basic user handling. Those of you who don’t use Symfony should be able to carry the core ideas across to your framework of choice. If you’re looking to start using Symfony then I’d recommend Knp University’s screencast on Joyful Development with Symfony 3.

Link: https://dzone.com/articles/how-to-verify-phone-numbers-with-php-symfony-and-t?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Red Hat Updates Python, PHP, Node.js, More; Supports New Arches

I am pleased to announce the immediate availability of Red Hat Software Collections 3.0 Beta, Red Hat’s newest installment of open source development tools, dynamic languages, databases, and more. Delivered on a separate lifecycle from Red Hat Enterprise Linux with a more frequent release cadence, Red Hat Software Collections bridges development agility and production stability by helping you create modern applications that can be confidently deployed into production. Most of these components are also available in Linux container image format to streamline microservices development.
In addition to these new components having traditional support for x86_64, Red Hat Software Collection 3.0 Beta adds support for three new architectures: s390x, aarch64, and ppc64le.

Link: https://dzone.com/articles/red-hat-updates-python-php-nodejs-more-supports-ne?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev