Emoji Calculator is a prototype calculator, using emojis instead of regular math symbols, and created with Laravel 5.3 and Bootstrap v3.3.6.
We have firstly to clone the project locally: git clone https://github.com/thitami/EmojiCalculator.git
composer install
so to install the project and all its dependencies..env.example
file into the same directory (base dir) and rename it to .env
. This file stores our configuration settings.php artisan key:generate
.php artisan serve
, which uses PHP's built-in server and by default listens to port :8000
.Then, we visit localhost:8000
in a browser and we are ready to use it!
When we hit localhost:8000
the following actions take place:
Route::get('/','CalculatorController@homepage')
route is matched in web.php
CalculatorService
is called to load the Operand symbols supplied in the .env
file.config/calculator.php
file, and rendered in the view.
We are using a basic layout, which is stored under resources/views/calculator/home.blade.php
.Route::post('/calculate',['as' => 'calculator.getResult', 'uses' => 'CalculatorController@getResult']);
The emojis used by the calculator can be configured in the .env
file:
CALCULATOR_ADD_OPERAND = '👽'
CALCULATOR_SUBTRACT_OPERAND = '💀'
CALCULATOR_DIVIDE_OPERAND = '👻'
CALCULATOR_MULTIPLY_OPERAND = '😱'
Please consider that if we set the same symbol for a different operation then the following defaults will be loaded:
'add' => '👽',
'subtract' => '💀',
'multiply' => '👻',
'divide' => '😱',
This project has a unit test coverage. PHPUnit tests can be found in tests/CalculationTest.php
and get simply executed
with the command phpunit
from the base directory.
The Laravel framework is open-sourced software licensed under the MIT license.