1. Go to this page and download the library: Download flsouto/obj2cli 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/ */
MyApp{
function generate_file_name($name, $ext='txt'){
echo $name.'.'.$ext;
}
}
obj2cli(new MyApp());
s MyApp{
function multiply($number){
return new Multiply($number);
}
}
class Multiply{
var $number;
function __construct($number){
$this->number = $number;
}
function by($number2){
echo $this->number * $number2;
}
}
obj2cli(new MyApp());
// ...
class Multiply{
var $number;
function __construct($number){
$this->number = $number;
}
// Customize name of context
function getObj2cliName(){
return "Multiply $this->number....";
}
function by($number2){
echo $this->number * $number2;
}
}
//...