Install Node NPM on mac

brew install node


REDIS LARAVEL ConnectionException Error while reading line from the server.

Redis connection issue laravel Fix due to SSL read error on connection

Database config: config/database.php

'redis' => [
        'client' => 'predis',
        'cluster' => false,

        'default' => [
            'scheme'   => env('REDIS_SCHEME', 'tls'),
            'host'     => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port'     => env('REDIS_PORT', 6379),
            'database' => 0,
        'cache' => [
            'scheme'   => env('REDIS_SCHEME', 'tls'),
            'host'     => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port'     => env('REDIS_PORT', 6379),
            'database' => 1,
        'queue' => [
            'scheme'   => env('REDIS_SCHEME', 'tls'),
            'host'     => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port'     => env('REDIS_PORT', 6379),
            'database' => 2,
        'options' => [
            'parameters' => [
                'password' => env('REDIS_PASSWORD', null),

Redis MAC

brew update
brew install redis

To Start

brew services start redis

to stop 

brew services stop redis

Or, if you don’t want/need a background service you can just run:

redis-server /usr/local/etc/redis.conf

Test if Redis server is running.

redis-cli ping

If it replies “PONG”, then it’s good to go!

Location of Redis configuration file.


Uninstall Redis and its files.

brew uninstall redis
rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

How to fix ? Symfony\Component\Debug\Exception\FatalErrorException Declaration of Doctrine\DBAL\Driver\PDOConnection::query() must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed …$fetchModeArgs)

How to fix ?

Symfony\Component\Debug\Exception\FatalErrorExceptionDeclaration of Doctrine\DBAL\Driver\PDOConnection::query() must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed …$fetchModeArgs)

#1 – I removed from composer.json the following line

"doctrine/dbal": "^2.10",

#2 – Run composer upgrade

#3 – Run composer upgrade

Voila Job Done !


How to switch PHP version on a mac with brew?

$ brew unlink [email protected] 

$ brew install [email protected]
$ brew link [email protected] --force --overwrite

How to save (control + s ) file and send [sftp,ftp] to web server – PHPStorm


MACos DBeaver configuration connection backup Json

On OSX (Mac) here:


Connect to your Forge server using SSH or SFTP

Create SSH Key for Github

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa (regular unix system)
$ ssh-add -K ~/.ssh/id_rsa (for macbook)

$ pbcopy < ~/.ssh/ (for macbook)

Paste key into github

$ git remote add origin [email protected]:xxxxxx/xxxxxxx.git  
$ git remote -v 
$ git push -u origin master

Feb, 7 2019—#forge

Using Laravel Forge you can easily configure push-to-deploy to your sites, you can also manually deploy from the dashboard. However, sometimes you wish to access your sites’ files directly using SSH or SFTP.

To be able to do that you’ll need to add your machine’s public key to the server, this step allows the SSH service on your server to identify connections from your computer and grant access.

Depending on your Operating System, you can find guides on how to generate an SSH key in this link.

Adding an SSH Key

To add an SSH key to your server, head to the SSH Keys section of the server settings screen:

Adding an SSH Key

Once the key is added, you can SSH into your instance using the following command:

ssh [email protected]_address_here

To use SFTP, you need to download an SFTP client like FileZilla or Cyberduck. Once you run the client, provide the credentials as follow:

  • Protocol: SFTP
  • Address/Server: your_ip_address
  • Port: 22
  • Username: forge
  • Password: Leave this blank.
  • SSH Private Key: Location to the private key on your machine.

Once you press connect, the client will communicate with the server and acquire access to all the files and directories.

By Mohamed Said

Full-stack developer at Laravel. You can find me on Twitter and Github.


Install MacOs softwares From Scratch for PHP developer

Install Composer

php -r "copy('', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

Make Composer Global

mv composer.phar /usr/local/bin/composer


/bin/bash -c "$(curl -fsSL"


To get started, you first need to ensure that Homebrew is up to date using the update command:

brew update

Next, you should use Homebrew to install PHP:

brew install php

After installing PHP, you are ready to install the Composer package manager. In addition, you should make sure the ~/.composer/vendor/bin directory is in your system’s “PATH”.

export PATH="$PATH:$HOME/.composer/vendor/bin"

After Composer has been installed, you may install Laravel Valet as a global Composer package:

composer global require laravel/valet

Finally, you may execute Valet’s install command. This will configure and install Valet and DnsMasq. In addition, the daemons Valet depends on will be configured to launch when your system starts:

valet install

Once Valet is installed, try pinging any *.test domain on your terminal using a command such as ping foobar.test. If Valet is installed correctly you should see this domain responding on

Valet will automatically start its required services each time your machine boots.

PHP Versions

Valet allows you to switch PHP versions using the valet use [email protected] command. Valet will install the specified PHP version via Homebrew if it is not already installed:

valet use [email protected]

valet use php
Interview questions

DEVELOPER Methodologies to follow

DRYDo not Repeat Yourself
KISSKeep It Studid Simple
SOLIDSolid Principles
Big O NotetationDo not Repeat Yourself
Function not bigger than 30 linessmaller function to make code more readable
PSR ImplementationDescription
PSR-2Coding Style Guide
PSR-3Logger Interface