Skip to content

Instantly share code, notes, and snippets.


Juyal Ahmed tojibon

Block or report user

Report or block tojibon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tojibon /
Last active May 9, 2019
Search for a specific column name in all the tables in MySQL database?
    table_schema = 'DB_NAME' AND    
tojibon / composer.json
Last active May 8, 2019
Creating a package with Laravel 5.6 for a printing company ex: Alpha and the package name ex: Library.
View composer.json
"autoload": {
"classmap": [
"psr-4": {
"App\\": "app/",
"Alpha\\Library\\": "packages/Library/src/"
tojibon / readme.MD
Last active May 27, 2019
My Laravel Best Practices
View readme.MD
  • Always follow PSR2 - PSR4 php coding style, better install it on PHPStorm
  • Always validate things via RequestValidators even if it is nullable(), Move validation from controllers to Request classes.
  • Use child relationships to get child data and filter data
  • Make sure if there is any auto generated codes like __construct
  • How can a array count ever be less than 0? Check to use a simple condition instead of making it complex with double check
  • Check if there is anything should actually fail if it doesn't have a set value
  • It's a good idea to check first for the less costly conditions (especially inside a loop)
  • Always use Carbon for date processing
  • Maintain code commenting and proper docblock
  • Always use custom env for static values, do not get data from the .env file directly
tojibon /
Last active Apr 27, 2019
Setting up VirtualHost for Symfony App in Ubuntu
sudo vim /etc/apache2/sites-available/symfony-test-app.conf
<VirtualHost *:80>
  <IfModule mod_rewrite.c>
    RewriteEngine on
tojibon / api.php
Last active Apr 17, 2019
Laravel fire an Artisan command from an HTTP route by using Artisan facade
View api.php
Route::get('/foo', function()
$exitCode = Artisan::call('command:name', ['--option' => 'foo']);
tojibon /
Created Apr 12, 2019
Installing symfony client
wget -O - | bash
export PATH="$HOME/.symfony/bin:$PATH"
sudo mv /home/juyal/.symfony/bin/symfony /usr/local/bin/symfony
// Added in 5.1.11:
php artisan make:policy PostPolicy
// Displays help for a given command
php artisan --help OR -h
// Do not output any message
php artisan --quiet OR -q
// Display this application version
php artisan --version OR -V
// Do not ask any interactive question
tojibon /
Created Apr 1, 2019 — forked from JamesMGreene/
A comparison of using `git flow` commands versus raw `git` commands.


gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

tojibon / mysql.bat
Created Feb 8, 2019
Connect MySQL + Create Database + Import SQL via terminal
View mysql.bat
mysql -u root -p
CREATE USER 'phpapp_user'@'localhost' IDENTIFIED BY 'phpapp_user_pass';
GRANT ALL ON phpapp_db.* TO 'phpapp_user'@'localhost';
mysql -u phpapp_user -pphpapp_user_pass -D phpapp_db;
mysql -u phpapp_user -pphpapp_user_pass -D phpapp_db < dummy_data.sql;
View app.dockerfile
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
You can’t perform that action at this time.