Top 10 PHP Errors From 1,000+ Projects (and How to Avoid Them)

Recently, we looked at our database of thousands of projects and found the top 10 errors in PHP apps. We’re going to show you what causes them and how to prevent them. Avoiding these “gotchas" will make you a better developer.
Because data is king, we collected, analyzed, and ranked the top 10 PHP errors. Rollbar collects all the errors for each project and summarizes how many times each one occurred. We do this by grouping errors according to their fingerprints. We group two errors if the second one is just a repeat of the first. This gives users an excellent overview instead of an overwhelming big dump like you’d see in a log file.

Link: https://dzone.com/articles/top-10-php-errors-from-1000-projects-and-how-to-av?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

PHP Monolog Tutorial: A Step-by-Step Guide

In application development or maintenance, logging is very important. It gives you the right amount of data that you need to help you monitor your application, logs, databases, code, and web services. Monolog is the existing standard logging library for PHP. It is most popular in PHP frameworks such as Laravel and Symfony, where it implements a common interface for logging libraries.
This article talks about the step-by-step process of using PHP Monolog in your application.

Link: https://dzone.com/articles/php-monolog-tutorial-a-step-by-step-guide?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

18 PHP Tools for Developers of All Levels

PHP is a fast scripting language that is ubiquitous with web development. WordPress uses the language as it’s core interface for developers to enhance the platform. It’s relatively easy to learn and is well supported by the development community.
While PHP helps developers create web applications quickly, there is no development environment associated with the language. By contrast, a development environment such as Visual Studio from Microsoft comes with many features available from installation. Visual Studio has features for coding, debugging, and deploying available to developers straight out of the box.

Link: https://dzone.com/articles/18-php-tools-for-developers-of-all-levels?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Functional PHP: A First Approach

Functional PHP? Well, PHP is not a functional language but some functional techniques may be used to improve our code: better readability, easier to maintain => cheaper code. 
For many years, PHP was scripted in a procedural way, all in one file with functions everywhere. After version 5.*, applications have been written using the Object Oriented paradigm (OO). But rarely do we think of PHP in the functional paradigm. Of course, PHP is not a functional language, but we should be able to use the best of each paradigm. It’s not about OO against functional programming (FP), or to define which one is better.

Link: https://dzone.com/articles/functional-php-a-first-approach?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

PHP vs. Golang: A Comparison

The PHPvs. Golang comparison is a tough one. Initially created in 1994, PHP has been around for 24 years. Since then, PHP has seen its popularity rise due to its open source format, ease of use, and stability. However, as happens in every other aspect of life, the old have to make way for the new if they are not able to adapt to modern times. Even the most recent versions of PHP such as PHP 7 have left a lot to be desired in terms of security, scalability, concurrency and more. As times have changed, so have the demands of applications. Quickly deployable, concurrent, scalable, bug-free, low maintenance, and cost-efficient applications are the demand of the day.
Golang has time and again proven itself as a safe bet for Enterprise Applications. The following are just some of the features in which Golang outperforms PHP and turns out to be a wiser choice for businesses.

Link: https://dzone.com/articles/php-golang-a-comparison?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Processing Large Files Using PHP

If you want to process large files using PHP, you may use some of the ordinary PHP functions like file_get_contents() or file() which have a limitation when working with very large files.
Memory Limitation
These functions rely on the memory_limit setting in the php.ini file; you may increase the value but these functions still are not suitable for very large files because these functions will put the entire file contents into memory at one point.

Link: https://dzone.com/articles/processing-large-files-using-php?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Dynamic Class Instantiation and NS in PHP

The first step in developing every program’s business, right after designing and defining the required classes, is class instantiation. And it is a very straightforward process. You call the class constructor which is exactly the same as the class name, followed by the respective namespace, pass the required arguments (if any), and that’s it.
The scenario described above is exactly what happens in nearly all situations. But there is a condition where exceptions may arise: whenever you try to instantiate a class dynamically.

Link: https://dzone.com/articles/dynamic-class-instantiation-amp-ns-in-php?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

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