Download the PHP package stanx/extdirect without Composer

On this page you can find all versions of the php package stanx/extdirect. 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 extdirect

ExtDirect.php for ExtJS

Extremely Easy Ext.Direct integration with PHP

Original author : J. Bruni
Fork: stanx

How to use:

1) PHP

Here, "Server" is the PHP class we want to provide access from the JavaScript code. It could be any other class.

2) HTML:

Here, "ext-direct.php" points to the PHP file shown on item 1. If you want to output API for Ext Designer you must add "?json" query string, because the default output is on javascript format. It may be changed by $default_api_output

3) JavaScript:

Here, to call the "date" method from PHP "Server" class, we prepended the default namespace Ext.php. The first parameter is the $format parameter. The second parameter is the JavaScript callback function that will be executed after the AJAX call has been completed. Here, an alert box shows the result.

Features

That's all.

Configuration options

formHandler

There are two different ways to flag a method as a formHandler.

Method 1: use the new ExtDirect::$form_handlers configuration option.

Method 2: include @extdirect-formHandler in the DOC comment of the method.

Example:

In the example above, due to the @extdirect-formHandler string inside the method's DOC comment, it will be flagged as a formHandler method.

It has the same effect as this:

Receiving parameters

The parameters sent by forms are adapted to be received by the class method.

Pay attention now, because this is not usual.

I will use the "set_ftp_password" method above as the example.

First, note that we don't want that all formHandler methods have the same not-friendly signature, like this:

$data is the user input (usually $_POST)

So, to be able to keep normal method signatures, like this...

...I have implemented the following solution:

When the method/action function is a formHandler, its parameter values are taken from the input names that matches the parameter's names.

So... $_POST['account'] will automatically become the $account parameter...

$_POST['password'] value will be the $password parameter value...

...and from where the $password_confirm parameter value will come from? Yes! From $_POST['password_confirm']

That's it: the method's parameters' names matches the $_POST array keys.

Advantages:

Disadvantages:

Of course, all validation / filtering / sanitization of input data, as always, must be carefully considered.

Additional note about file upload:

If your file input name is userFile, it will be available in your method/function parameter named $userFile

In other words: your $userFile parameter will receive the value from $_FILES['userFile']

Intercept functions

With the declare_method_function, you can determine if method declaration is allowed or not.

Now, you are able to specify an authorization_function, where you can check the user permissions and return true or false accordingly, allowing the API call or not.

instantiate_function will be called in API action call to instantiate object of class. This is useful if you are using a DI container to instantiate classes.

With the transform_result_function, you can modify the result of the API method call after its execution, but before it is sent to the client-side.

Finally, with the transform_response_function, you can modify the response structure. This allows firing server-side events, and to send extra server side data together with the RPC result.


All versions of extdirect with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 stanx/extdirect contains the following files

Loading the files please wait ....