Skip to content

PHP Phone Book (Apache HTTP Server - MySQL database, PDO Connection - OOP - MVC - Twig template engine - Bootstrap) - Licensed MIT

License

Notifications You must be signed in to change notification settings

ramoures/PHP-Phone-Book

Repository files navigation

PHP Phone Book

فارسی | English


Demo

UTC Timezone

Setup

  1. Create a new MySQL database.
  2. Set your database information and your PROJECT_URL in config.php.

3 & 4:

  1. Browse /setup to create the required tables and admin sign up.

    Ex. https://localhost/PHP-Phone-Book/setup/

  2. Remove /setup directory.

OR

  1. Remove /setup directory.
  2. IMPORT php_phone_book.sql to your database table.

    The username added after import is: admin , password: 123

  1. Set media directory permission to 777.

    $ sudo chmod -R 777 media

  • Browse your project url. Ex. https://localhost/PHP-Phone-Book/ | Admin panel: https://localhost/PHP-Phone-Book/admin2023

Requirement

  • Apache HTTP web server.
  • MySQL database
  • PHP ^8.2.4
  • Apache module mod-rewrite must be enabled.
  • mysqli, mysqlnd, pdo ,pdo_mysql PHP extensions must be enabled.

To check the above: <?php phpinfo(); ?> - PHPInfo

  • allowOverride must be set to All (for your root directory) in the Apache configuration file.

Information

  • HTTP server: Apache
  • Programming language: PHP 8.2.4
  • Programming paradigm: OOP
  • Architectural patterns: MVC
  • Template engine: TWIG 3.0
  • Database: MySQL
  • Licensed under MIT

I used:

  • URL Routing methods.
  • TWIG template engine.
  • PDO & Prepared Statements MySQL Connection.
  • Singleton design patterns for some required classes.
  • Multi language support.
  • Many options for configuration. config.php
  • Sorting and pagination of items.
  • Client and server side captcha for sign in form.

    Optional config: Google reCaptcha or Cloudflare Turnstile

  • Errors handling method.
  • Bootstrap and jQuery.

HELP

Add new language

  1. Create your language file in the lang folder.

Ex. fr.php or ar.php and develop similar to lang/fa.php.

  1. Add your new language for frontend pages.
<!-- Example: -->
<div class="changeLanguage">
     <button id="fr">Fr</button>
     <button id="en">En</button>
</div>
<!-- Look at: .changeLanguage click function on view/assets/js/app.js or backend.js  -->


Solutions

Enable the apache module mod_rewrite

$ sudo a2enmod rewrite

Set config allowoverride All

Edit the Apache config file:

$ cd /etc/apache2

$ sudo nano apache2.conf

Find:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

And change it to:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

/var/www/ : your root directory.

Press Ctrl + o (for save), then Ctrl + x (for exit).

Then,

$ sudo systemctl restart apache2

Apache mod_rewrite module


Linkedin: ramoures
E-mail: [email protected]