PHPackages                             mohasin-dev/column-visibility - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mohasin-dev/column-visibility

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mohasin-dev/column-visibility
=============================

A Laravel package to save and restore DataTables column visibility per user

281PHP

Since Apr 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mohasin-dev/column-visibility)[ Packagist](https://packagist.org/packages/mohasin-dev/column-visibility)[ RSS](/packages/mohasin-dev-column-visibility/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Column Visibility
=========================

[](#laravel-column-visibility)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b8274e9f7eaf8b76cec42c4d648a7acb81e6b4016ea4f90ac02b07d0f00db0f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f686173696e2d6465762f636f6c756d6e2d7669736962696c6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohasin-dev/column-visibility)[![GitHub Stars](https://camo.githubusercontent.com/2f8562b429e49a5c0e0d2d4faf6f0fda60f697ac8bb64e5b60f2ff8b03f356a7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d6f686173696e2d6465762f636f6c756d6e2d7669736962696c6974793f7374796c653d666c61742d737175617265)](https://github.com/mohasin-dev/column-visibility/stargazers)[![Total Downloads](https://camo.githubusercontent.com/63299594adef4bbfc3d87714d64cab7e850886ca1bd35c208aae091fea6130af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f686173696e2d6465762f636f6c756d6e2d7669736962696c6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohasin-dev/column-visibility)[![License](https://camo.githubusercontent.com/bd55a1ebb658fc20ba476eb3b3f1aa3211a5fc87a93c9238e5b326d6213f877d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6f686173696e2d6465762f636f6c756d6e2d7669736962696c6974793f7374796c653d666c61742d737175617265)](LICENSE)

A Laravel package for managing and persisting DataTables column visibility preferences per user across sessions and devices.

---

[![Problem Solution UI](column-visibility.png)](column-visibility.png)

---

🚀 Features
----------

[](#-features)

- **User-Specific Column Visibility**: Saves each user's column visibility preferences.
- **Automatic Restoration**: Automatically restores column settings upon each visit to the table.
- **Blade Component**: Dynamically inject column visibility preferences via a Blade component.
- **Global Usage**: Works across any table in your Laravel project.
- **Easy Integration**: Simple to install, configure, and customize.
- **Compatibility**: Built for Laravel 9, 10, and 11.

---

📦 Installation
--------------

[](#-installation)

1. **Install the package via Composer**:

    ```
    composer require mohasin-dev/column-visibility
    ```
2. **Then publish assets and migrate the database**:

    ```
    php artisan vendor:publish --tag=public
    php artisan vendor:publish --tag=views
    php artisan migrate
    ```

### 🧩 Usage

[](#-usage)

Step 1: Include Blade Component in View

```

// table-key: Unique string to identify your table (e.g. users, orders)
// table-id: ID of your HTML table ()

```

Step 2: Use JS Helper in Your DataTable Init

```
let table = $('#dataTable').DataTable({
  columnDefs: buildColumnDefs([0, 4, 5, 6, 9]), // param is optional: text-center targets
  ...
});

```

### 🧠 How It Works

[](#-how-it-works)

- Saves column preferences (hidden columns) in a column\_preferences table.
- Automatically injects hidden columns for the user via a Blade component.
- The JS helper buildColumnDefs() builds the correct columnDefs dynamically.

### 🛠️ Requirements

[](#️-requirements)

```
PHP 8.0+
Laravel 9, 10, or 11
jQuery DataTables

```

### 🤝 Contributing

[](#-contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.

### 📝 License

[](#-license)

This package is open-source software licensed under the MIT license.

### 🙌 Author

[](#-author)

Mohasin Hossain

Portfolio →

LinkedIn →

GitHub →

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 56.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c5f6534cfa56fdb477cc79ec8db2c5c1bb73f6471981bedf2ec0cac6b17789c?d=identicon)[mohasin-dev](/maintainers/mohasin-dev)

---

Top Contributors

[![mohasin-dev](https://avatars.githubusercontent.com/u/43562178?v=4)](https://github.com/mohasin-dev "mohasin-dev (9 commits)")[![WSF202201](https://avatars.githubusercontent.com/u/118959681?v=4)](https://github.com/WSF202201 "WSF202201 (7 commits)")

### Embed Badge

![Health badge](/badges/mohasin-dev-column-visibility/health.svg)

```
[![Health](https://phpackages.com/badges/mohasin-dev-column-visibility/health.svg)](https://phpackages.com/packages/mohasin-dev-column-visibility)
```

###  Alternatives

[openbuildings/monetary

Useful tool for formatting and converting currencies

10207.6k1](/packages/openbuildings-monetary)[saeedvaziry/ip2location

IP to Location database

322.2k](/packages/saeedvaziry-ip2location)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
