PDiary is a Laravel web application to learn basic CRUD (Create, Read, Update, Delete) with Laravel. Alongside Blade, Bootstrap 5.3 is also used for front-end side for the sake of practice. By preference, I use diaries for the CRUD objects for no particular reason.
To run this project locally, for me, I'm using Herd for Nginx and PHP-8.3, and XAMPP for MySQL.
- Git (to clone the repository)
- Composer (to manage Laravel dependencies)
- Herd (for Nginx and PHP)
- XAMPP (for MySQL)
git clone https://github.com/wesleyaldrich/PDiary.git
cd PDiary
Make sure you have Composer installed, then run:
composer install
Duplicate the .env.example
file and rename it to .env
:
cp .env.example .env
Edit the .env
file to configure the database and other necessary settings. Example configuration for MySQL (using XAMPP):
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pdiary
DB_USERNAME=root
DB_PASSWORD=
php artisan key:generate
Start XAMPP and enable MySQL. Create a new database for your project in phpMyAdmin. For this case, you may want to name it "pdiary". If phpMyAdmin refuses to run (since Apache won't start), you may have to disable Nginx temporarily in Herd by doing:
herd stop
Then, run the database migrations:
php artisan migrate
Make sure you have Herd installed, start the default Herd services:
herd start
This will start Nginx and PHP services. Once you have Herd installed, it is recommended to put the "pdiary" folder inside "Herd" directory (in my case: "C:\Users\Wesley\Herd\pdiary").
Open the Herd desktop application and go to "Open Sites", you will see the information about your web app if it's inside the Herd directory. Click "Open" in the "Database" row to open AdminerEvo. Or you can simplify this whole process by visiting the URL:
http://database.herd.test
Or you can also do this instead if you have the same local MySQL credentials as me to simplify even more.
http://database.herd.test/?mysql&server=127.0.0.1:3306&username=root&password=&db=pdiary
Once you've followed the setup steps, the local web app is accessible by visiting the URL:
http://pdiary.test
You should see the PDiary web application running locally.
- Note: Your web app URL could be different, double check by opening your Herd desktop application and go to "Open Sites" to see the information about your web app if it's inside the Herd directory.