This project is like a sandbox. The purpose is to implement some cool features to improve my symfony skills but also to help people. This app should be a very good example to show how I implement things like Panther or Mercure ! Feel free to report bugs with an issue !
Also, to improve this project, I'm using some tools like :
This project requires
$ git clone https://github.com/pifaace/symfony-blog.git
$ docker-compose run --rm --no-deps blog-server composer install
$ docker run --rm -it -v $(pwd):/application -w /application node yarn install
I'm using Webpack encore to build assets. Some commands are available, you can run those in a container like :
$ docker run --rm -it -v $(pwd):/application -w /application node yarn encore dev
$ docker run --rm -it -v $(pwd):/application -w /application node yarn encore dev --watch
$ docker run --rm -it -v $(pwd):/application -w /application node yarn encore production --progress
Just notice that, running those in a container do not trigger webpack-notifier. You should run these commands directly on your host to use it. In this case be sure you have yarn installed.
$ docker-compose up -d
$ start http://localhost:8000/ # Windows
$ open http://localhost:8000/ # Mac
$ docker-compose stop
$ docker-compose exec blog-server php bin/console doctrine:migrations:migrate
And run datafixtures
$ docker-compose exec blog-server bin/console hautelook:fixtures:load
You can connect as admin with these infos :
login : admin
password : azerty
To use features that implements swiftmailer, you need to add a MAILER_URL in .env You can use mailtrap for your developments, so your MAILER_URL should look like this :
MAILER_URL=smtp://smtp.mailtrap.io:25?encryption=&auth_mode=cram-md5&username=your_username&password=your_password
For registration with Github, you should register your own OAuth app, follow this link for a quick tutorial. The authorization callback URL should be :
http://localhost:8000/login/github/callback
When your app created, you should get a client ID and client secret, remplace these informations in the .env file in the right section. and that's it !
$ docker-compose run --rm blog-server ./bin/phpunit
All tests from tests/Functional are writing with Panther
I implemented a notification feature to test how can we use Mercure in situation. At the moment, a notification will trigger each authenticated user when an admin published a new article. The only thing you are suppose to modify is in docker-composer file
mercure:
image: dunglas/mercure
ports:
- '3000:80'
environment:
- JWT_KEY=symfonyBlogJwtToken
- PUBLISH_ALLOWED_ORIGINS=*
- CORS_ALLOWED_ORIGINS=http://symfony-blog.fr:8000
- DEBUG=1
You should adapt the CORS_ALLOWED_ORIGINS value. In general it would be localhost
This project is released under the MIT license.