git clone https://github.com/g0ld3lux/laravel-starter
composer install
npm install
php artisan key:generate
php artisan jwt:secret
Note: Location May Vary Depending on Your Operating System
For Windows the path is: C/Windows/System32/drivers/etc/hosts
Add the Following hosts
127.0.0.1 laravel.dev
127.0.0.1 api.laravel.dev
- env.simple = Very Minimal Requirement , sqlite , and Mail Driver set to MailTrap.io for dev
- env.docker = If your Using Docker , and Want to Simulate api.laravel.dev and laravel.dev
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
cp .env.docker .env
If Your Not Familiar With Laradock Please Visit The Official Site
code
- laradock
- api (APP FOLDER)
// Add here Other Site Folder
go inside your code folder then
git clone https://github.com/Laradock/laradock.git
cd laradock
cp env-example .env
at laradock folder
cd nginx/sites
edit default.conf
server {
listen 80;
listen [::]:80;
server_name api.laravel.dev laravel.dev; // <-- Our App Domain and Api Domain
root /var/www/public; //<-- Our App Root Folder
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Set the Following ENV var
DB_HOST=mysql
REDIS_HOST=redis
QUEUE_HOST=beanstalkd
Inside Your Laradock Folder
docker-compose up -d nginx mysql redis beanstalkd
code
- api (APP FOLDER)
- laradock
go inside your app folder
git submodule add https://github.com/Laradock/laradock.git
cd laradock
cp env-example .env
Inside Laradock Folder
APPLICATION=../api/
cd nginx/sites
cp project-1.conf api.conf
vim api.conf
server {
listen 80;
listen [::]:80;
server_name api.laravel.dev laravel.dev; // <-- Our App Domain and Api Domain
root /var/www/api/public; //<-- Our App Root Folder
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Set the Following ENV var
DB_HOST=mysql
REDIS_HOST=redis
QUEUE_HOST=beanstalkd
Inside Your Laradock Folder
docker-compose up -d nginx mysql redis beanstalkd
You can add your cron jobs to workspace/crontab/root after the php artisan line.
* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1
# Custom cron
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
Make sure you change the timezone if you don’t want to use the default (UTC).
docker exec -it laradock_workspace_1
docker exec -it laradock_mysql_1
docker exec -it laradock_redis_1
Note: if you replace the folder laradock to other name you will need to change also the name of your containers
docker exec -it foldername_containername_1
- At your App folder
composer require pda/pheanstalk
- At your App folder
composer require predis/predis
- At Your Laradock Folder
docker exec -it laradock_mysql_1 bash
mysql -u root -p
password: root
create database api;
exit