This repo aims to help developers maintain external Laravel packages.
Includes folders
host
default Laravel instancedocker
config filespackages
folder that includes each of packages
docker-compose up -d
should be enough
- Laravel is at http://localhost:1000
- Adminer (database UI) is at http://localhost:8079/
By default Laravel is using mysql
DB, but you can change this in host/.env
file
Enter bash by calling docker-compose exec escola_lms_app bash
, then lanuch any command like artisan
or composer
.
Repeat those steps for each package
-
Clone your package to a folder inside this repo, in
packages
folder (git clone XXX package
). Add your folder to.gitignore
-
Amend Host Laravel
host/composer.json
to point to freshly cloned package repository. Assuming your package name is escolalms/packagename, it can be done by invoking following command from within the container:
composer config repositories.escolalms/packagename '{ "type": "path", "url": "../packages/packagename" }'
2.1. (Optional)
In case you'll be generating your own swagger documentation you might want to alter host/config/l5-swagger.php
as follows:
Before:
'annotations' => [
base_path('vendor/escolalms/headless-h5p/src'),
//base_path('app')
],
After:
'annotations' => [
base_path('vendor/escolalms/mypackage/src'),
//base_path('app')
],
Above example is assuming that your package name is mypackage
.
- Enter bash (instruction above), then add you packge with
composer require escolalms/headless-h5p
That's it - now you have laravel working with docker that is using package from other folder that is git
maintained.
Note instruction below is for VSCODE, yet it should work with minor changes in other IDEs like PHPStorm.
- Add mapping to
.vscode/launch.json
Before:
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}/host",
}
},
After:
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}/host",
"/var/www/package": "${workspaceFolder}/package"
}
},
- Enable Xdebug
Note instruction below is for VSCODE, nad Xdebug 3 (included in this Docker), port 9003 yet it should work with minor changes in other IDEs like PHPStorm. Our settings is based on DevilBox (Configure Xdebug).
- Uncomment all Xdebug settings from
docker/xxx-devilbox-default-php.ini
- Add host address alias, eg on MacOS
sudo ifconfig lo0 alias 10.254.254.254
- Restart docker with
docker-compose stop escola_lms_app && docker-compose rm escola_lms_app && docker-compose up -d
- Install default Xdebug debugging tools
- Add at least one breakpoint to your package
- Select option
Listen for Xdebug
from IDE debugger - Run your app with XDEBUG GET query param, example
http://localhost:1000/api/hh5p/library?XDEBUG_SESSION_START=VSCODE
- Debugger should stop on breakpoint in IDE