PHP is one of the most famous scripting language to develop websites. Though some people think it's obsolete and slow and what not, i still love it for it's simplicity.

I am writing some of the things which i love about PHP in this blog

1. Elegant and simple OOPs

I can't tell you how easy is it to work with classes in PHP, let me give you an example

class SampleClass extends AnotherClass {
    public __constructor(){
    private function aMethod(){

Pretty straight forward isn't it.Spaghetti code gets messy and unmanageable as the number of lines of code increase, so classes solves this issue.

2. Composer autoloading of custom classes

Yes, i am talking about the classes written by you in your project. Gone are those days where we had to do require_once or include etc.

    "require"  : {},
    "autoload" : {
        "classmap" : [ 

Just add autoload clause, with folder paths where you have stored your classes separated by comma.
Classmap will work till you have unique classnames, if you don't shift to PSR-4 vs PSR-0

3. Codeception - Testing package

We often use var_dump and exit to debug/test run our code. Whenever you doing that just write a Unit test.
Codeception is current best for api,functional,unit and acceptance tests.
Wait will shown you a sample code

$I->fillField('username', 'davert');
$I->fillField('password', 'qwerty');
$I->see('Welcome, Davert!');

Beautiful isn't it? you will love it for sure.

4. PHP7

This needs a special mention

PHP7 is almost 3x faster than PHP5

It was built ground up to meet the new standards. If you are still using PHP5, you should shift ASAP.

5. Multi-threading

PHP doesn't have inbuilt threading, but pthreads is a good library using which we can do parallel processing in PHP.

passthru is an inbuilt php function where you can execute a shell command asynchronously. This can be used smartly to run scripts parallely.

6. Reporting critical errors to slack channel

monolog and it's awesome!
Use the SlackHandler to push your errors/logs from server to one of your slack channel. It has various features to handle various error levels.
It has various handles which can be attached to various error levels. See all the handlers, which includes Slack,IFTTT,Mail,HipChat etc.

These are some of my recent favourites, i will keep adding to this over time.

Tech PHP