1. Go to this page and download the library: Download rougin/classidy 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/ */
rougin / classidy example snippets
bash
$ php index.php
namespace Acme;
/**
* Sample class for Acme.
*
* @package Acme
*
* @author John Doe <[email protected]>
*/
class Greet
{
public function greet()
{
return 'Hello world!';
}
}
php
// index.php
use Acme\Hello\Greeter;
// ...
// Define the details of the class ---
// ...
$class->extendsTo(Greeter::class);
// ...
// -----------------------------------
// ...
bash
$ php index.php
namespace Acme;
use Acme\Hello\Greeter;
/**
* Sample class for Acme.
*
* @package Acme
*
* @author John Doe <[email protected]>
*/
class Greet extends Greeter
{
public function greet()
{
return 'Hello world!';
}
}
bash
$ php index.php
namespace Acme;
use Acme\Hello\Greeter;
/**
* Sample class for Acme.
*
* @package Acme
*
* @author John Doe <[email protected]>
*/
class Greet extends Greeter implements Greetable, Helloable
{
public function greet()
{
return 'Hello world!';
}
}
php
// index.php
use Acme\Hello\Traitable;
// ...
// Define the details of the class ---
// ...
$class->addTrait(Traitable::class);
// ...
// -----------------------------------
// ...
bash
$ php index.php
namespace Acme;
use Acme\Hello\Traitable;
/**
* Sample class for Acme.
*
* @package Acme
*
* @author John Doe <[email protected]>
*/
class Greet
{
use Traitable;
public function greet()
{
return 'Hello world!';
}
}
php
// index.php
// ...
// Add a "greet" method in the class ---
$method = new Method('greet');
$method->setCodeEval(function ()
{
return 'Hello world!';
});
$class->addMethod($method);
// -------------------------------------
// ...
bash
$ php index.php
namespace Acme;
use Acme\Hello\Greeter;
/**
* Sample class for Acme.
*
* @package Acme
*
* @author John Doe <[email protected]>
*/
class Greet extends Greeter implements Greetable, Helloable
{
/**
* @param \Acme\Test $test
*
* @return string
*/
public function greet($test)
{
return $test->hello();
}
}
php
// index.php
// ...
$method = new Method('greet');
// Set the method as "protected" ---
$method->asProtected();
// ---------------------------------
// Set the method as "private" ---
$method->asPrivate();
// -------------------------------
// ...
php
// index.php
// ...
$method = new Method('greet');
// ...
// Set as "@method" in the class ---
$method->asTag();
// ---------------------------------
// ...
bash
$ php index.php
namespace Acme;
use Acme\Hello\Greeter;
/**
* Sample class for Acme.
*
* @method string greet(boolean $shout = false)
*
* @package Acme
*
* @author John Doe <[email protected]>
*/
class Greet extends Greeter implements Greetable, Helloable
{
}