You must have completed the installation setup before doing this.
Now go and visit localhost:18080 in your browser. You should see a foodsharing instance running on your local machine :)
For generating a bit of initial data to play with, execute the seeding script:
It will give you some users that you can log in with:
Please refer to the User Roles and Permissions section for details on the different roles.
Tip: You can use private browser windows to log in with multiple users at the same time!
The script also generates more dummy users and dummy data to fill the page with life (a bit at least).
Should you want to modify it, have a look at the file
Whenever you make changes to non-PHP frontend files (e.g. .vue, .js or .scss files), those are directly reflected in the running docker instance. Changes to PHP files will require a page reload in your browser.
To stop everything again, just run:
PHPMyAdmin is also included: localhost:18081. Log in with:
There you can directly look at and manipulate the data in the database which can be necessary or very useful for manual testing and troubleshooting.
MailDev is also included: localhost:18084. There you can read all e-mails that you write via the front end.
We use php-cs-fixer to format the code style. The aim is to make it use the same style as phpstorm does by default. The fixer is based on the @Symfony ruleset, with a few changes.
To format all files, you can run:
vendor/bin/php-cs-fixer fix --show-progress=estimating --verbose
For convenience, you can and should add the code style fix as a pre-commit hook. So you will never commit/push any PHP code that does not follow the code style rules.
There are two possibilities:
When PHP >= 7.0 is installed locally and the vendor folder is in place (by having used the automated tests or the dev environment), you can use your computers PHP to check/fix the codestyle, as this is the fastest option:
Adding this to
.git/hooks/pre-commit could look like that:
#!/bin/sh HASH_BEFORE=$(git diff | sha1sum) ./scripts/fix-codestyle-local # or use # vendor/bin/php-cs-fixer fix --show-progress=estimating --verbose # or # ./scripts/fix # if the -local script throws an error HASH_AFTER=$(git diff | sha1sum) if test "$HASH_AFTER" != "$HASH_BEFORE" ; then echo "PHP Codestyle was fixed. Please read the changes and retry commit." exit 1; fi
Executing the following script will use the dev environment to run the codestyle check. As it currently always runs a new container using docker-compose, it will take some seconds to execute:
If you happen to use PHPstorm you can add
php-cs-fixer to those settings as well:
You can use the php cs fixer Extension. It should work right after a restart. To fix a file right click on it and select
You can even configure it to fix your code style after saving a file under: Settings>PHP CS Fixer>Execute PHP CS Fixer on save for not commiting any non-fixed code.
Note: You need PHP installed locally for this.
Depending on your editor you need to do nothing or install or configure a plugin to use the file
.editorconfig. Please refer to the section about Code style.