1. Go to this page and download the library: Download netherphp/standards 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/ */
netherphp / standards example snippets
class Project {
public function
DoSomething(int $Count):
void {
/*//
this method does something. we do not know exactly because this example
is not important enough to fill with an implementation.
//*/
$Cur = 0;
while($Cur < $Count) {
// ...
}
return;
}
}
class Project {
public function
DoSomething(int $Count):
void {
/*//
this method does something. we do not know exactly because this example
is not important enough to fill with an implementation.
//*/ [...]
}
}
namespace Nether\OneScript;
use ThirdParty1;
use ThirdParty2;
use ThirdParty3\Somespace\SomeClass;
use ThirdParty3\Filterspace\SomeInterface;
class Project
extends SomeClass
implements SomeInterface {
// ...
}
namespace MyApp\Subspace;
use Nether;
class Project {
public function
SetSomething():
void {
// ...
return;
}
static public function
GetFromFile(string $Filename):
string {
// ...
return $Contents;
}
}
class Project {
public function
Search(array|object $Input=NULL):
SearchResult {
/*//
@argv object Input
@argv array Input
//*/
$Input = new Nether\Object($Input,[
'Query' => NULL,
'Page' => 1,
'Limit' => 25,
'Owner' => NULL
]);
// ...
return $Result;
}
}
class Project {
public function
GetFileContents(string $Filename) {
/*//
@return ?StdClass
given a filename return the object built from the contents of that file.
//*/
$Data = NULL;
$Obj = NULL;
$Error = NULL;
try {
$Data = $this->GetFileContents_ReadFile($Filename);
$Obj = $this->GetFileContents_ParseData($Data);
}
catch(Exception $Error) {
// log error or something.
return NULL;
}
return $Obj;
}
protected function
GetFileContents_ReadFile(string $Filename):
string {
/*//
check that the file is readable from the filesystem.
//*/
if(!file_exists($Filename) || !is_readable($Filename)
throw new Exception("{$Filename} not found or unreadable.");
return file_get_contents($Filename);
}
protected function
GetFileContents_ParseData(string $Data):
StdClass {
/*//
check that the file was parsable.
//*/
$Obj = json_decode($Data);
if(!is_object($Data))
throw new Exception("Unable to parse data.");
return $Obj;
}
}