Download the PHP package kanel/phpclasseditor without Composer

On this page you can find all versions of the php package kanel/phpclasseditor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpclasseditor

phpClassEditor

build

This library allows you to dynamically edit php class files by injecting code into them

How it works

Important : unless you call the save method, the file won't be changed Each function that edits the php class file return the new content of the file (after adding properties/methods)

1 Indentation

Before you create any property or method, you need to define what indentation to use.

Default one is 4 spaces.

If you want to change the default behaviour :

The example above means you want the default indentation to be 1 tab.

You can only use :

2 Adding properties to a class

You can inject properties into a php class file.

The example above adds three properties to the class

2.1 Property class

the "addProperty" method takes in a Property class.

A Property class must have at least a name (mandatory), defined in the construct

This will print in the class :

You can also set a "visibility" to your property in the construct (optional)

All the visibilities are defined in the Visibility class :

You can also define the property's default value (optional too)

will print

You can write whatever value you want (as string), or use the ones predefined in the Value class:

Finally, the last construct parameter allows to choose if the property is static (true) or not (false):

will print

All the parameters in the constuct (except the name) have designated setters, you can use:

will print :

3 Adding methods to a class

You can inject methods into a php class file.

The example above adds two methods to the class

The name and the visibility are both mandatory in the construct

All the visibilities are defined in the Visibility class :

You can define multiple things using the Method class : is it static? abstract? final ? does it have a return type? a doc comment? parameters ?

Since a method can not be both final and abtract, it is the last one set to true that is taken.

so this will print:

Note the the return type can be anything you send, you can also use the consts defined in Type class

You can also add parameters to your method. The Method class has an "addParameter" function that allows to you add as many parameters as needed. These are all the possible parameters classes you can use :

Each one of these parameters classes takes in a mandatory name in their construct

They also take in a default value as second parameter (except for ClassParameter, see below) when there is one

You can use the predefined ones or add yours

The last parameter is a boolean that tells if the parameter is a splat or not A splat is the ... annotation that allows to send multiple parameters

Please note also that each parameter

The ClassParameter has a slightly different construct as it takes as a second parameter the full class name

This will print :

You must have noted that params and return type will always generate a docComment


All versions of phpclasseditor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kanel/phpclasseditor contains the following files

Loading the files please wait ....