Download the PHP package starfolksoftware/inertia-table without Composer

On this page you can find all versions of the php package starfolksoftware/inertia-table. 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 inertia-table

Inertia.js Tables for Laravel Query Builder

Latest Version on NPM npm Latest Version on Packagist run-tests

Features

Compatibility

Note: There is currently an issue with using this package with Vite!

Installation

You need to install both the server-side package and the client-side package. Note that this package is only compatible with Laravel 9, Vue 3.0, and requires the Tailwind Forms plugin.

Server-side installation (Laravel)

You can install the package via composer:

The package will automatically register the Service Provider which provides a table method you can use on an Interia Response.

Search fields

With the searchInput method, you can specify which attributes are searchable. Search queries are passed to the URL query as a filter. This integrates seamlessly with the filtering feature of the Laravel Query Builder package.

Though it's enough to pass in the column key, you may specify a custom label and default value.

Select Filters

Select Filters are similar to search fields but use a select element instead of an input element. This way, you can present the user a predefined set of options. Under the hood, this uses the same filtering feature of the Laravel Query Builder package.

The selectFilter method requires two arguments: the key, and a key-value array with the options.

The selectFilter will, by default, add a no filter option to the array. You may disable this or specify a custom label for it.

Columns

With the column method, you can specify which columns you want to be toggleable, sortable, and searchable. You must pass in at least a key or label for each column.

The searchable option is a shortcut to the searchInput method. The example below will essentially call $table->searchInput('name', 'User Name').

Global Search

You may enable Global Search with the withGlobalSearch method, and optionally specify a placeholder.

If you want to enable Global Search for every table by default, you may use the static defaultGlobalSearch method, for example, in the AppServiceProvider class:

Example controller

Client-side installation (Inertia)

You can install the package via either npm or yarn:

Add the repository path to the content array of your Tailwind configuration file. This ensures that the styling also works on production builds.

Table component

To use the Table component and all its related features, you must import the Table component and pass the users data to the component.

The resource property automatically detects the data and additional pagination meta data. You may also pass this manually to the component with the data and meta properties:

If you want to manually render the table, like in v1 of this package, you may use the head and body slot. Additionally, you can still use the meta property to render the paginator.

The Table has some additional properties to tweak its front-end behaviour.

Property Description Default
striped Adds a striped layout to the table. false
preventOverlappingRequests Cancels a previous visit on new user input to prevent an inconsistent state. true
inputDebounceMs Number of ms to wait before refreshing the table on user input. 350
preserveScroll Configures the Scroll preservation behavior. You may also pass table-top to this property to scroll to the top of the table on new data. false

Custom column cells

When using auto-fill, you may want to transform the presented data for a specific column while leaving the other columns untouched. For this, you may use a cell template. This example is taken from the Example Controller above.

Multiple tables per page

You may want to use more than one table component per page. Displaying the data is easy, but using features like filtering, sorting, and pagination requires a slightly different setup. For example, by default, the page query key is used for paginating the data set, but now you want two different keys for each table. Luckily, this package takes care of that and even provides a helper method to support Spatie's query package. To get this to work, you need to name your tables.

Let's take a look at Spatie's QueryBuilder. In this example, there's a table for the companies and a table for the users. We name the tables accordingly. So first, call the static updateQueryBuilderParameters method to tell the package to use a different set of query parameters. Now, filter becomes companies_filter, column becomes companies_column, and so forth. Secondly, change the pageName of the database paginator.

Then, we need to apply these two changes to the InertiaTable class. There's a name and pageName method to do so.

Lastly, pass the correct name property to each table in the Vue template. Optionally, you may set the preserve-scroll property to table-top. This makes sure to scroll to the top of the table on new data. For example, when changing the page of the second table, you want to scroll to the top of the table, instead of the top of the page.

Pagination translations

You can override the default pagination translations with the setTranslations method. You can do this in your main JavaScript file:

Table.vue slots

The Table.vue has several slots that you can use to inject your own implementations.

Slot Description
tableFilter The location of the button + dropdown to select filters.
tableGlobalSearch The location of the input element that handles the global search.
tableReset The location of the button that resets the table.
tableAddSearchRow The location of the button + dropdown to add additional search rows.
tableColumns The location of the button + dropdown to toggle columns.
tableSearchRows The location of the input elements that handle the additional search rows.
tableWrapper The component that wraps the table element, handling overflow, shadow, padding, etc.
table The actual table element.
head The location of the table header.
body The location of the table body.
pagination The location of the paginator.

Each slot is provided with props to interact with the parent Table component.

Testing

A huge Laravel Dusk E2E test-suite can be found in the app directory. Here you'll find a Laravel + Inertia application.

Upgrading from v1

Server-side

Client-side

v2.1 Roadmap

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of inertia-table with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2
illuminate/support Version ^9.37|^10.0|^11.0
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 starfolksoftware/inertia-table contains the following files

Loading the files please wait ....