PHP code example of yoosuf / calculator

1. Go to this page and download the library: Download yoosuf/calculator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yoosuf / calculator example snippets


composer dump-autoload

php artisan optimize

php artisan make:provider CalculatorServiceProvider



Route::get('calculator', function(){
	echo 'Hello from the calculator package!';
});

public function boot()
{
    //
    

php artisan make:controller CalculatorController



namespace yoosuf\Calculator;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class CalculatorController extends Controller
{
    //
    public function add($a, $b){
    	echo $a + $b;
    }

    public function subtract($a, $b){
    	echo $a - $b;
    }
}

public function register()
{
    // register our controller
    $this->app->make('yoosuf\Calculator\CalculatorController');
}

public function register()
{
    // register our controller
    $this->app->make('yoosuf\Calculator\CalculatorController');
    $this->loadViewsFrom(__DIR__.'/views', 'calculator');
}

public function add($a, $b){
	$result = $a + $b;
	return view('calculator::index', compact('result'));
}

public function subtract($a, $b){
    $result = $a + $b;
    return view('calculator::index', compact('result'));
}