PHP code example of ksfraser / financial-models

1. Go to this page and download the library: Download ksfraser/financial-models 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/ */

    

ksfraser / financial-models example snippets


use Ksfraser\Financial\Dcf\Assumptions;
use Ksfraser\Financial\Dcf\DcfEngine;

$assumptions = Assumptions::fromArray([
    'base_revenue' => 389.5,
    'revenue_cagr' => 0.05,
    'ebitda_margin' => 0.30,
    'da_pct' => 0.03,
    'capex_pct' => 0.04,
    'nwc_pct' => 0.01,
    'tax_rate' => 0.25,
    'wacc' => 0.09,
    'terminal_growth' => 0.025,
    'net_debt' => 0,
    'shares_outstanding' => 3000,
]);

$engine = new DcfEngine();
$result = $engine->run($assumptions);
echo $result->getIntrinsicPerShare();

use Ksfraser\Financial\ThreeStatement\Assumptions;
use Ksfraser\Financial\ThreeStatement\ForecastEngine;

$assumptions = Assumptions::fromArray([
    'base_revenue'     => 100,
    'base_cogs_pct'    => 0.6,
    'base_opex_pct'    => 0.2,
    'base_da_pct'      => 0.03,
    'base_cash'        => 5,
    'base_ar'          => 10,
    'base_inventory'   => 8,
    'base_ppe_net'     => 40,
    'base_ap'          => 7,
    'base_st_debt'     => 2,
    'base_lt_debt'     => 10,
    'base_equity'      => 54,
    'revenue_growth'   => 0.03,
    'gross_margin'     => 0.4,
    'opex_pct'         => 0.2,
    'da_pct'           => 0.03,
    'capex_pct'        => 0.04,
    'nwc_pct'          => 0.01,
    'tax_rate'         => 0.25,
    'new_debt_annual'  => 5,
]);

$engine = new ForecastEngine();
$years = $engine->project($assumptions);