Skip to content

A Laravel & VueJS package for creating Ajax DataTables.

License

Notifications You must be signed in to change notification settings

mtrdesign/krait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

Total Downloads Latest Stable Version

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.

Krait Package Monorepo

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.

Official Documentation

More information about the package can be found on the Krait Docs Website.

Quickstart

Krait's installation process is pretty simple, you can follow this guide to get everything configured quickly and then review the detailed official docs.

Installation

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
});

Usage

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.

Contribution

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.

License

Krait is open-sourced software licensed under the MIT license.