This project is only a technical test to show some basic skills using Laravel PHP framework.
But... your pull requests are always welcome!!!. Knowledge needs to be shared.
Share your knowledge.
It’s a way to achieve immortality.
Dalai Lama
First of all, be sure you have a local copy of the repository in your filesystem.
You can achieve that typing:
$ git clone https://github.com/JordiTL/laravel-technical-test.git
$ cd laravel-technical-test
Then you have to create your local Homestead configuration file or using it globally (see website):
$ composer install
$ php vendor/bin/homestead make
Now you need to run the virtual machine via Vagrant:
$ vagrant up
[Optional] Add your custom mapping to your hosts file
You can add it manually by appending the following lines to your /etc/hosts
file:
#The following line is added automatically to map Homestead host
[homestead-ip] homestead.app
Or adding it automatically running:
$ printf "\n#The following line is added automatically to map Homestead host\n`grep -Po '(?<=ip: ").*(?=")' Homestead.yaml` homestead.app\n" | sudo tee --append /etc/hosts
Now you have to connect via ssh to your Homestead instance:
$ vagrant ssh
And run inside it:
$ cd [project-folder]
$ composer install
For example:
$ cd /home/vagrant/Work/Laravel/laravel-technical-test/
$ composer install
We need to generate the database schema before we can use the app. But before that we need to generate an environment file:
$ cp .env.example .env
$ php artisan key:generate
Then we need to create the database an users (feel free to change this settings in your production environment):
$ mysql -uhomestead -psecret
mysql> CREATE DATABASE laraveltest;
mysql> GRANT ALL PRIVILEGES ON laraveltest.* TO 'laraveluser'@'localhost' IDENTIFIED BY 'laravelpassword';
mysql> quit;
And then in project folder (inside homestead) run:
$ php artisan migrate
If you want a default usertry:
$ php artisan db:seed
- email: user@test.com
- password: password
The last step is to run Npm and Gulp to generate the public resources:
$ npm install
$ gulp
And... you are done to test the app!
The application has a built-in web scraper. It is configured to scrap the web hourly with the Laravel Scheduler. The bad news are that Laravel Scheduler will only work if you add a cron to your system:
$ crontab -e
And add the following line:
* * * * * php [artisan-executable] schedule:run 1>> /dev/null 2>&1
For example:
* * * * * php /home/vagrant/Work/Laravel/laravel-technical-test/artisan schedule:run 1>> /dev/null 2>&1
This comes with a built-in commands. In the following sections you will see some of them.
This command will connect to http://www.appliancesdelivered.ie, download and store a collection of the ten cheapest products and the ten most expensive ones.
$ php artisan scraper:retrieval
You can check all available commands by running:
$ php artisan
This project is developed using git-flow methodology.
This project has associated TravisCI hooks to perform automatic testing. Here you can visit the project page on travis: https://travis-ci.org/JordiTL/laravel-technical-test
- Jorge Torregrosa Lloret ( jtorregrosalloret@gmail.com )
Like all software projects, there is always a way to improve them. This is not an exception. The following lines will enumerate a few cool future features:
- Redis | Memcached | Hazelcast datagrid integration.
- Front-end improvements.
- Advanced scraping + crawling functionality.
- Advanced customization scraper options.
- Separate scraper to a custom project.
- Stripe payment API integration.
- E2E testing with PhantomJS
- ...
And maybe some crazy stuff:
- Realtime owner-customer chat
- Telegram (messaging app) sync with the chat
- Administrator capabilities to control [Juno](https://en.wikipedia.org/wiki/Juno_(spacecraft)
The MIT License (MIT)
Copyright (c) 2016 Jorge Torregrosa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.