Skip to content

OlivierFL/blog

Repository files navigation

Maintainability Quality Gate Status

Blog

Project 5 - First blog built with PHP

Third party libraries

In order to install third party libraries, run composer install.

Packages used in this project :

  • Nikic FastRoute to handle routing
  • Twig as template engine
  • Slugify to generate slugs for blog posts
  • PhpMailer to send emails

Docker Installation

This project is developed with Docker.

To install this project on your local machine, simply clone this repository.

The stack is composed of 4 containers :

  • nginx
  • php
  • mysql
  • phpMyAdmin

Then launch the dev stack with Docker : docker-compose up -d.

The homepage is available on : blog.localhost:8080

Database configuration

Database configuration example is available in db-config.yaml.example.

In order to have a working connection, copy and paste the content of db-config.yaml.example in a file called db_config.yaml. This file will be parsed to get the data needed by the PDOFactory to connect to the database.

When using Docker, the name of the database host is not localhost, but the name of the container, which by default is mysql.

An SQL dump file with sample data is available in the dumps folder.

The phpMyAdmin container url is blog.localhost:8000 with root login and admin password. This can be changed in the docker-compose file.

Sample data

In order to have a fully functional blog, the SQL file contains :

  • 3 users with different states :

    • an admin user with [email protected] login email and Admin1234! password. This user has role admin and can create blog posts, and handle users, comments and social networks in admin dashboard.
    • a simple user with [email protected] login email and User1234! password. This user can post comments on blog posts.
    • a deleted user. This user has role disabled, personal data are anonymised and user can't connect to the blog.
  • 5 blog posts. 3 posts per page are displayed with pagination.

  • 5 comments created by various users and in different states (pending, rejected and approved).

Sending emails

Emails are sent with php mailer package. To send emails, create mail.yaml configuration file. An example configuration is available in mail.yaml.example file.

Code quality

Links to code quality tools used for this project:

About

Project 5 - First blog built with PHP

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published