Download the PHP package jameslevi/stencil without Composer
On this page you can find all versions of the php package jameslevi/stencil. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package stencil
Stencil
Is a simple PHP Class templating library.
Getting Started
-
You can install via composer.
-
If not using any framework, paste the following code at the upper part of your project to load the composer autoload mechanism.
- Basic implementations.
The code above will generate PHP file with content like this.
Import Class Implementation
You can use "use" method to import classes in to your template.
You can also set alias for your imported class to avoid naming conflict.
This command will generate code like this.
Extend Classes
You can extend class using "extends" method. Just make sure you imported your parent class.
Implement Interfaces
You can implement one or more interface classes using "implement" method.
The example above will generate code like this.
Abstract Class
You can set your class as an abstract class.
The example above will generate code like this.
Raw Content
You can add content in each line using "raw" method. You can use "setIndention" method to set tab spaces in the beginning of each line.
The example above will generate code like this.
Line Breaks
You can add single line break using "lineBreak" method.
You can also make multiple line breaks by providing the first argument.
Constants
You can declare constant values in your class using "addConstant" method.
The example above will generate code like this.
Variables
You can declare class variables with public, private and protected visibility.
The above example will generate code like this.
Non-Static Variables
Variables that are only accessible when class is instantiated.
The above example will generate code like this.
Static Variables
Variables that are accessible even without instantiating a class.
The above example will generate code like this.
Single Line Comment
You can add single line comment using "addLineComment" method.
The above example will generate code like this.
Block Comment for Variables
You also add multi-line comments using "addComment" method.
The above example will generate code like this.
Method Functions
You can add methods for your class using "addMethod" method.
The above example will generate code like this.
Static Methods
You can also set if method is static using "setAsStatic" method.
The above example will generate code like this.
Method Arguments
You can add multiple arguments in your method using "addParam" method.
The above example will generate code like this.
Method Content
You can add content in to your method using "raw" method.
The above example will generate code like this.
Abstract Method
You can also add abstract method in to your abstract class using "setAsAbstract" method.
The above example will generate code like this.
Block Comments for Methods
You can add block comments using "addComment" method.
The above example will generate code like this.
Constructor Method
You can also add constructor to your class using "makeConstructor" static method.
The above example will generate code like this.
Contribution
For issues, concerns and suggestions, you can email James Crisostomo via [email protected].
License
This package is an open-sourced software licensed under MIT License.