Download the PHP package bluetea/ajax-response-bundle without Composer

On this page you can find all versions of the php package bluetea/ajax-response-bundle. 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 ajax-response-bundle

AjaxResponse for Symfony2

This repository contains an AjaxResponse implementation which allows you an easy-to-use Ajax implementation in the frontend (javascript) and backend (PHP).

The bundle does relies on the Symfony2 framework and JMS Serializer.

Installation

Get a copy of the repo!

You can load this repository with composer:

If you don't use composer, load the repository with GIT:

Add the bundle to the AppKernel.php:

Implementation

This bundle is implemented automatically in the backend via the AjaxResponseListener. The frontend implementation should be done manually.

Frontend

First we should load the javascript files including jQuery, jQuery-ui, Pnotify and BlockUI.

or with assetic:

Then initialize the ajaxProtocol and blockUi widgets.

Usage

Backend

The AjaxResponse overrides the constructor of the Response object. Two additional parameters are added: type and data. The type is the most important part because it’s used by the ajaxProtocol.js to determine which action is expected. Example: the “modal” type opens a modal. The data parameter is used if you like to send additional data.

There are four types implemented:

The AjaxResponse contains 5 parameters: content, type, data, status and headers.

The content parameter contains the data of the type:

So, if you want to send a modal to the frontend your code should look like this:

And if you want to fire an event in javascript:

All possible AjaxResponse types:

Don't pre-serialize the data. The data is serialized to JSON by the AjaxResponseListener.

Frontend

You should use the AjaxProtocol widget to enable all advantages of the AjaxResponse. The AjaxProtocol widget handles modal, redirect and event triggering automatically. If you want to do something manual, override the successCallback and use the DATA type in the AjaxResponse object in the backend.

All options:

Just call an URL. The data parameters contains the POST or GET parameters and the type is default ‘POST’ but can be set to ‘GET’. The beforeSendCallback is a function callback and is executed before the AJAX call is made. The successCallback is a function callback and is executed as the AJAX call is successful. The failCallback is a function callback and is executed as the AJAX call has failed.

Example for a modal:

Example for an event:

Example for posting data:

Example when using dataTables:


All versions of ajax-response-bundle with dependencies

PHP Build Version
Package Version
Requires jms/serializer-bundle Version *
symfony/http-foundation Version 3.4.*
symfony/http-kernel Version 3.4.*
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 bluetea/ajax-response-bundle contains the following files

Loading the files please wait ....