1. Go to this page and download the library: Download bzfvrto/carbonize 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/ */
bzfvrto / carbonize example snippets
$distance = new Distance(
from: new Point(1, 2),
to: new Point(4, 5)
);
$distance
->setSteps([new Point(1,3), new Point(2, 4)])
->calculate();
// output (float) distance in meters: 516972.895251
$vehicle = new Vehicle(
combustible: Combustible::B7,
consumptionAvgInLiterFor100Km: 7.5,
location: Country::FRANCE
);
$vehicle->emission()->getCO2EquivalentInGramsPerKm();
// output (float) C02e in grammes per km: 232.5
(new Carbonize(
vehicle: $vehicle,
distance: $distance))->formatedResult();
// output (string): 120196.198 gramme of CO2 emited for 516.97 km
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.