Skip to content

Instantly share code, notes, and snippets.

View samirreza's full-sized avatar
🤦‍♂️

Amirreza samirreza

🤦‍♂️
View GitHub Profile
@samirreza
samirreza / Laravel Bootstratpping Process
Last active November 5, 2020 08:43
Laravel Bootstratpping Process
1. set LARAVEL_START global variable
2. check for maintenance mode
3. register composer autoloader
4. create new application instance
1. set some paths in service container as instance
2. define "app" and Container::class instance in service container with current application instance
3. register base service providers : EventServiceProvider - LogServiceProvider - RoutingServiceProvider
1. create service provider instance and path application instance to its constructor
2. call register method on service provider
3. read "bindings" property of service provider if exists and bind its key/value in service container
@samirreza
samirreza / Symfony Bootstratpping Process
Last active June 26, 2020 05:59
Explain Symfony Bootstratpping Process (to be continued !!!)
1. load environment variables from .env files in _ENV and _SERVER super global among APP_ENV and APP_DEBUG
2. enable debug component if APP_DEBUG is true
3. instantiate kernel with APP_ENV and APP_DEBUG
4. create Request object from super globals
5. call handle method on kernel with Request object
1. prepare registered bundles array
2. initialize service container
1. initiate ContainerBuilder object and add its definition with service_container id
2. add some kernel parameters
3. if kernel implement CompilerPassInterface, add it as compiler pass
@samirreza
samirreza / changeRemoteUrl.sh
Created April 19, 2019 13:16
Shell script to bulk change git remote url
directoryContainingAllRepos="" # directory containing all git repo's
oldGitRemoteServer="" # current remote server url for example gitlab.com
newGitRemoteServer="" # new remote server url for example git.example.com
cd $directoryContainingAllRepos
find * -maxdepth 0 -type d \( ! -name . \) -print | while read dir
do
cd $dir
if [ -d ".git" ]
then
remoteUrl1="$(git config --get remote.origin.url)"
@samirreza
samirreza / db_backup.sh
Created September 2, 2018 05:01
shell script for backup mysql database
backup_parent_dir="/Applications/MAMP/htdocs/test"
mysql_user="root"
mysql_password="root"
db_name="cms"
db_port="8889"
days=3
excluded_tables=(
log
)
mysql_executable_folder="/Applications/MAMP/Library/bin"
define global constant.
register composer autoloader.
include Yii class file.
load application configuration.
creating application instance :
set Yii::$app.
call preInit :
confige high order properties like basePath.
register error handler.
configure other application properties.