Giraffe
Ajax: Server/Client Helper/Router, (*1)
, (*2)
supports:
* DataTables
* Ajax Uploads
* Redirects
* Notifications
* Modals
* General all purpose Ajax
* Debugging, (*3)
Install: Server Side
index.php / bootstrap.php, (*4)
Add this to one or both of these php files:, (*5)
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:, (*6)
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
., (*7)
Giraffe can update your Javascript File when composer updates the package., (*8)
Giraffe is designed to be used in conjunction with JQuery., (*9)