All Projects → pifaace → symfony-blog

pifaace / symfony-blog

Licence: other
Symfony blog example with Docker, Panther, Mercure

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to symfony-blog

action-mercure
🚀 GitHub Action for Mercure.
Stars: ✭ 14 (-72%)
Mutual labels:  mercure
python-mercure
Python library to publish messages to Mercure Hub!
Stars: ✭ 18 (-64%)
Mutual labels:  mercure
panther
Estimating similarity between vertices is a fundamental issue in network analysis across various domains, such as social networks and biological networks. Methods based on common neighbors and structural contexts have received much attention....
Stars: ✭ 27 (-46%)
Mutual labels:  panther
laravel-mercure-broadcaster
Laravel broadcaster for Mercure
Stars: ✭ 73 (+46%)
Mutual labels:  mercure
async-messenger-mercure
Demo for Symfony Messenger + Mercure
Stars: ✭ 27 (-46%)
Mutual labels:  mercure
Mercure
Server-sent live updates: protocol and reference implementation
Stars: ✭ 2,608 (+5116%)
Mutual labels:  mercure
Api Platform
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.
Stars: ✭ 7,144 (+14188%)
Mutual labels:  mercure
node-mercure
📳 Mercure Hub & Publisher implemented in node.js.
Stars: ✭ 27 (-46%)
Mutual labels:  mercure

Build Status

Symfony-blog 4.4

What's Symfony-blog ?

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 :

Getting Started

Installing

This project requires

Clone the project

$ git clone https://github.com/pifaace/symfony-blog.git

Run dependencies

$ docker-compose run --rm --no-deps blog-server composer install
$ docker run --rm -it -v $(pwd):/application -w /application node yarn install

Assets

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.

Running Docker containers

Running containers

$ docker-compose up -d
$ start http://localhost:8000/ # Windows
$ open http://localhost:8000/ # Mac

Stopping containers

$ docker-compose stop

Migrations

$ docker-compose exec blog-server php bin/console doctrine:migrations:migrate

And run datafixtures

$ docker-compose exec blog-server bin/console hautelook:fixtures:load

Account

You can connect as admin with these infos :

login : admin
password : azerty

SMTP

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

Github OAuth

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 !

Running tests

$ docker-compose run --rm blog-server ./bin/phpunit

All tests from tests/Functional are writing with Panther

Mercure feature

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

License

This project is released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].