The objective of this project is to create a URL shortener using Laravel.
This project utilizes Laravel version 6.2. As this is an older version of Laravel, certain requirements must be fulfilled in the development environment.
- PHP: 7.2
- Composer: 2.2
- Node.js: Required for frontend dependencies
- PHP
- Composer
- Node.js
-
Clone the project repository:
git clone https://github.com/atakanhr/webdev-simpleprojects.git
-
Install the vendor files using Composer:
composer install
-
Copy the
.env.example
file and create a new file named.env
. -
Generate the application secret key and add it to the
.env
file using the following command:php artisan key:generate
-
Configure your database settings in the
.env
file. The application requires a database. -
Migrate the database tables:
php artisan migrate
-
Start the project:
php artisan serve
-
You can access the application at
localhost:port
. For example: http://localhost:8000
The Docker setup allows you to launch a ready-made deployment environment with a single command, eliminating the need for manual installation of tools such as PHP.
- MySQL deployment
- Nginx deployment
- Tools including PHP, Redis, Composer, NPM, and Artisan
To use the Docker setup, extract the auto-deployment
folder from the project and copy it to a separate location.
-
Run
docker-compose up
. This command will initially build the necessary images, for example,php:7.2.0-fpm-alpine
, and apply custom configurations. Once the system is up, Nginx will serve onlocalhost:80
. -
To initialize the Laravel project, place your project code within the
src
folder that is created under theauto-deployment
directory. -
Copy the
env.example
file and create a file named.env
. Fill in the SQL information from the Docker Compose file (since they will be on the same network, usingmysql
as the database IP address is sufficient). -
Execute the command
docker-compose run --rm composer install
. This command will create the vendor folder and download the necessary dependencies. -
Run the command
docker-compose run --rm artisan key:generate
. This command will generate the necessary application key and write it to the.env
file. -
Execute the command
docker-compose run --rm artisan migrate
. This command will process the database tables. -
Upon accessing
localhost:80
, the application panel will be displayed.