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

Null Safe operator is awesome ! Great code

Awesome piece of work, imagine to replace the follwoing piece of code

$country =  null;
if ($session !== null) {
    $user = $session->user;
    if ($user !== null) {
        $address = $user->getAddress();
        if ($address !== null) {
            $country = $address->country;

by just

$country = $session?->user?->getAddress()?->country; 


Timeout lambda function

If you define the following in your lambda function :

const receiver: SQSHandler = async (event, context, callback) => {

You should execute callback () otherwise your function will timeout

otherwise define as follow without callback and you will not have to worry about the callback()

const receiver: SQSHandler = async (event, context) => {


Useful catch (\Throwable $e)

catch (\Throwable $e) turned out to be very useful while coding in PHP.

When Exception were caught in specific instances, catch throwable would catch anything that would impede the code to run

Example below in a phpUnit scenario :

        try {
            $r = $this->checkKeys($data);
        } catch (\Throwable $e) {
            $this->assertEquals($e->getCode(), 404);

Model and Reward Vulnerability on Your Team

Today’s Tip 
Model and Reward Vulnerability on Your Team
For a team to innovate, people must be willing to disagree, dissent, and challenge the status quo. As a leader, it’s your job to set the conditions for this kind of intellectual bravery. First, check yourself: Make sure you reward vulnerability, rather than punish it, and be mindful of the signals you’re sending, implicitly or explicitly, that discourage disagreement or outside-the-box thinking. Next, encourage your team members to think beyond their role and function. You can also specifically assign someone on your team to play the role of devil’s advocate — their job is to challenge a course of action or find flaws in a proposed decision. Make sure you rotate that role so you can get a variety of perspectives. Whenever you reject a suggestion, express gratitude for the idea and explain your reasoning. Finally, model vulnerability by sharing your mistakes, asking questions, and admitting what you don’t know. Laying the groundwork for open and honest discussions could help your team come up with your company’s next great idea.
This tip is adapted from “To Foster Innovation, Cultivate a Culture of Intellectual Bravery,” by Timothy R. Clark



No 'Access-Control-Allow-Origin' header
access control check: The 'Access-Control-Allow-Origin' header contains multiple values
No 'Access-Control-Allow-Origin' header is present on the requested resource"


SetEnvIf Origin "^http(s)?://(.+.)?(|$" origin_is=$0
Header set Access-Control-Allow-Origin %{origin_is}e env=origin_is
Header set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Allow-Headers "Authorization"
Header always set Access-Control-Allow-Methods "GET"
Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"
Header always set Access-Control-Max-Age "600"

+10,000 Downloads QuickLogs – Log Parser ! Yoohooo !

Demo :


Useful if you are working from scratch on some projects and you find yourself without a quick interface to review the error logs produced. This package yana/dr comes with a quick authentication system called QuickAuth.

In 3 steps :

#1 – Install composer Package

composer require yana/dr

#2 – Update configuration file to read the log from [Yana/Logs/conf.php]

'error_log_path' => '/var/log/php-fpm/www-error.log',

#3 – Create the path/directory to visualize your logs and copy the following files


Download here :

Quick Auth

David Raleche QuickAuth
David Raleche QuickAuth
david raleche quicklogs
david raleche quicklogs
quickAuth by David Raleche
quickAuth by David Raleche

Developer Manifesto by David Raleche

4 Principles are guiding this methodology

- Readability
- Quality Assurance
- Logic
- Reusable code


PSR-2 code styling
Function no longer than 50 lines
PHP doc Block
TypeHint your functions

More information:

For better code readability we suggest PSR-2 code styling to be applied. We consider a function bigger than 25 lines is not an efficient function. For engaging this methodology we recommend 50 lines maximum per function. DocBloc are essentials. Swagger in a case of API writing is essential to be present.
A developer should be able to explain his work easily and quickly and should use materials to do so

Quality Insurance

No PHP error message
No PHP Warning messages
No PHP Notices
No hardcore credentials
Unit Testing

When executing the code we expect the quality assurance team to verify that no PHP errors, warnings, notices are produced. We also expect the QA team to go throughout the code to verify that no hardcore credentials are present within the code. Unit Test writing should be edited by QA team preferably


DRY (do not repeat yourself)
KISS (Keep it Stupid Simple)
SOLID principles

 Reusable Code

Use PHP throw exception
Use Object oriented techniques
Use static function

Use PHP throw exception
Use Object oriented techniques
Use static function

Add the following your PHP too get rid of PHP notices, warnings

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

Want to know more about my work around the LAMP stack world and other specialties? Sign up for our email brief for hand-picked articles, news, and more.


* indicates required