jrsaunders/giraffe

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Ajax: Server/Client Helper/Router

v1.0.1 2017-03-28 10:00 UTC

This package is not auto-updated.

Last update: 2021-10-02 11:17:52 UTC


README

Ajax: Server/Client Helper/Router

Latest Stable Version Total Downloads Latest Unstable Version License

supports:

  • DataTables
  • Ajax Uploads
  • Redirects
  • Notifications
  • Modals
  • General all purpose Ajax
  • Debugging

Install: Server Side

index.php / bootstrap.php

Add this to one or both of these php files:

use Giraffe\Giraffe;
Giraffe::setEnvironment(ENVIRONMENT);
Giraffe::setProject('MY SITE NAME OR PRJECT NAME');
Giraffe::setDeveloperEmails(
     'me@mailprovider.co.uk,my_partner@theirmailprovider.co.uk'
);
Giraffe::setJSDIR(__DIR__ . '/public/assets/js/giraffe/');

###Put a route in place to get to an ajax controller

Here is an example of how that ajax controller may look:

namespace MyApp\Ajax;

use Giraffe\Giraffe;

class Ajax 
{
    public function someMethodYouRouteToForAjax()
    {
        $allowedControllers = [Login::class, Dashboard::class];
        new Giraffe($allowedControllers, 'MyApp\\Controller\\', 'ajax', MYAPP_PATH . '/Views/ajax/');
    }
}

Install: Client/Front End Side

Create a folder named giraffe in your js directory. Then chown apache:apache giraffe or chmod 777 giraffe.

Giraffe can update your Javascript File when composer updates the package.

Giraffe is designed to be used in conjunction with JQuery.