Simple Weblog in OOP

A show-and-tell project to show my students how to create a simple but extendable and maintainable web application in php.

Features

  • PHP´s internal server
  • sqlite database
  • composer autoload

Run locally

  1. Clone the project.
    git clone https://github.com/steffengrahl/simple-weblog-oop.git
  2. Go to the project directory.
    cd simple-weblog-oop/
  3. Install composer locally in this project.
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php composer-setup.php --install-dir=bin --filename=composer
    php -r "unlink('composer-setup.php');"
    You can find the instructions at getcomposer.org
  4. Go to the public folder of the project
    cd public/
  5. Run install command. This will prepare the database, copy the .env file and install all dependencies with composer
    make install
  6. Start PHP´s internal server.
    php -S localhost:8000

Usage

Database

You don't have to create a database on your own. If you run the command make install the database will be created with all needed tables and columns. If there is something wrong with your database please run the command make install-database1 to reinstall again.


Footnotes

1 you will lose all data stored in your database