1. Go to this page and download the library: Download kanel/phpclasseditor 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/ */
kanel / phpclasseditor example snippets
$classEditor = new ClassEditor('path_to_php_class_file');
$classEditor->useIndentation(Indentation::TABS, 1);
class MyClass {
....
protected function bar()
{
}
protected function foo()
{
}
}
$method = new Method('bar', Visibility::PUBLIC);
$method->setIsStatic(true);
$method->setIsFinal(true);
$method->setIsAbstract(true);
$method->setReturnType(Type::INT);
$method->setDocComment('This is my bar function');
class MyClass {
....
/**
* This is my bar function
* @return int
*/
abstract public static function bar(): int
{
}
}
$method = new Method('bar', Visibility::PUBLIC);
$method->setDocComment('This is my bar function');
$method->setReturnType(Type::ARRAY);
$method->addParameter(new MixedParameter('param1'));
$method->addParameter(new IntParameter('param2', 1));
$method->addParameter(new ClassParameter('param3', MyClass::class, Value::NULL));
class MyClass {
....
/**
* This is my bar function
* @param mixed $param1
* @param int $param2
* @param My\NAMESPACE\MyClass $param3
* @return array
*/
public function bar($param1, int $param2 = 1, My\NAMESPACE\MyClass $param3 = null): array
{
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.