This project demonstrates how to build a basic web application with Laravel to provide basic functions:
-
Authentication
-
CSV file upload and insert to db.
-
Create worker to curl google search page using uploaded keywords.
-
PHP >= 7.1.3
-
PostgreSQL 12.2
-
Git
-
Composer
-
First, clone the repo:
$ git clone git@github.com:nhutle/laravel-crawler-app.git
-
Create
.env
file by rename.env.local
to be.env
-
Create a database locally named
laravel-crawler-app
-
Run following commands to initial project
$ composer install
$ php artisan key:generate
$ php artisan migrate
$ php artisan db:seed
$ php artisan serve
(or you can use XAMPP/XAMPP as you want to run server)
-
Add the following Cron entry to your server
* * * * * cd /laravel-crawler-app && php artisan schedule:run >> /dev/null 2>&1
-
Run unit test
$ ./vendor/bin/phpunit tests/
-
Default username and password generated by migration, feel free to change it on UserSeeder.php
username: nhutle
password: nhutle
-
Find sample csv under name
keywords.csv
Method | Path | Description |
---|---|---|
GET | /login | Login view |
POST | /login | Login with username/password |
GET | /upload | Upload view |
POST | /upload | Upload CSV file |
POST | /process_file | Process file |
GET | /statistics | Statistics view |
Method | Path | Description |
---|---|---|
POST | /api/login | Login with username/password to generate JWT |
POST | /api/upload | Upload CSV file |
POST | /api/process_file | Process file |
GET | /api/statistics | Get statistics |
I have tried to deploy the project on AWS Elastic Beanstalk but can not access it via SSH from my Windows, hence you can not log-in for sure. I will need to fix it then, at least succeed to ssh to my EC2.
Link to aws demo
-
No API implementation at the moment, but it's on my bucket list -
When click on
Open it
<- Google Page Cache, somehow its JavaScript redirects user to a new page. -
Live demo is broken.
-
Basic implementation. It took me 2 days to realize that PHP CodeIgniter fails to manage crob job efficiently, then Laravel came out. I spent 2 more days to learn Laravel and this app has been build in 3 days only.
If you discover a security vulnerability within this app, feel free to create issues and pull requests. I will take a look and fix them asap.
MIT License