Krait is a powerful Laravel package that simplifies the creation of Ajax Dynamic DataTables. It automates the initial structure development of front-end and back-end resources via simple CLI commands.
To ensure consistent versioning and enhance the core front-end components development, along with the PHP package we’ve introduced a dedicated front-end
library called krait-ui
. So the final package consists of two parts, included in this monorepo:
/krait-ui
: The VueJS-based DataTable UI kit that includes all front-end components./krait
: The main Laravel package that includes all back-end features.
More information about the package can be found on the Krait Docs Website.
Krait's installation process is pretty simple, you can follow this guide to get everything configured quickly and then review the detailed official docs.
You can install the package via Composer by running:
composer require mtrdesign/krait
Then, you should complete the installation by running:
php artisan krait:install
It's that simple! Now you have all the JS and PHP dependencies installed and configured.
And One Final Step...
To successfully run the front-end library, you should tell the Vue to use the krait-ui
plugin.
// Importing the Krait Vue plugin
import Krait from "@mtrdesign/krait-ui";
// Importing the autogenerataed tables module
import tables from './components/tables'
/**
* ... Here you initialise your VueApp ...
*
* const app = Vue.createApp({});
*/
app.use(Krait, {
tables: tables
});
To create your first table, run the following command:
php artisan krait:table MyFirstTable
This command will create three resources:
/app/Tables/MyFirstTable.php
- the table class definition (the table name, the columns, the callbacks, etc.)/app/Http/Controllers/Tables/MyFirstTableController.php
- the controller that fetches the table content/resources/js/components/tables/MyFirstTable.vue
- the front-end VueJS component that represents the data
IMPORTANT:
For consistency, all Table Classes in app/Tables
should end on Table
to be registered correctly.
For more details about the Installation and the Usage, please check the Official Docs.
Don't hesitate to raise issues and propose improvements! Any help is welcome!
You can find more information about the package development process in the monorepo projects:
/krait-ui
- for the front-end functionality/krait
- for the back-end functionality
More contribution details can be found in the Official Contribution Section.
Krait is open-sourced software licensed under the MIT license.