Search by

itstructure / laravel-grid-view

itstructure

Grid view for laravel framework

Package info

github.com/itstructure/laravel-grid-view

pkg:composer/itstructure/laravel-grid-view

Statistics

Installs: 52 841

Dependents: 2

Suggesters: 0

Stars: 24

Open Issues: 0

1.4.2 2026-12-01 14:25 UTC

README

Latest Stable Version Latest Unstable Version License Total Downloads Build Status Scrutinizer Code Quality Tests

Introduction

This package is to displaying the model data in a Grid table.

Grid view appearance

Requirements

  • laravel 5.5+ | 6+ | 7+ | 8+ | 9+ | 10+ | 11+ | 12+ | 13+
  • Bootstrap 4 or 5 for styling
  • php >= 7.1
  • composer

Installation

General from remote repository

Run the composer command:

composer require itstructure/laravel-grid-view "^1.4.2"

If you are testing this package from a local server directory

In application composer.json file set the repository, as in example:

"repositories": [
    {
        "type": "path",
        "url": "../laravel-grid-view",
        "options": {
            "symlink": true
        }
    }
],

Here,

../laravel-grid-view - directory path, which has the same directory level as application and contains Grid View package.

Then run command:

composer require itstructure/laravel-grid-view:dev-master --prefer-source

Publish files (Not necessary)

  • To publish views run command:

    php artisan grid_view:publish --only=views

    It stores view files to resources/views/vendor/grid_view folder.

  • To publish translations run command:

    php artisan grid_view:publish --only=lang

    It stores translation files to resources/lang/vendor/grid_view folder.

  • To publish all parts run command without only argument:

    php artisan grid_view:publish

    Else you can use --force argument to rewrite already published files.

Where this is already used (my packages)

You can see this packages above as examples.

Usage

Make sure you use Bootstrap 4 or Bootstrap 5 for styling in your application.

The grid works with both versions, for example with Laravel-AdminLTE v3 (Bootstrap 4) and v4 (Bootstrap 5). JQuery is not needed since version 1.3.0.

Controller part

A data provider gives the data to the grid. There are two data providers:

  • EloquentDataProvider - data from a database by an Eloquent model query.
  • ArrayDataProvider - data from an array or a collection, without a database (see below).

EloquentDataProvider

For EloquentDataProvider class constructor use a model query object.

Example:

namespace App\Http\Controllers;

use Itstructure\GridView\DataProviders\EloquentDataProvider;
class ExampleController extends Controller
{
    public function example()
    {
        $dataProvider = new EloquentDataProvider(ExampleModel::query());
        return view('example-view', [
            'dataProvider' => $dataProvider
        ]);
    }
}

ArrayDataProvider

Use it, when the data is not in a database: an array, a collection, a result of an API request, etc.

For ArrayDataProvider class constructor use an array or a collection of rows. A row can be an array or an object.

use Itstructure\GridView\DataProviders\ArrayDataProvider;
class ExampleController extends Controller
{
    public function example()
    {
        $dataProvider = new ArrayDataProvider([
            ['id' => 1, 'name' => 'Apple', 'price' => 100],
            ['id' => 2, 'name' => 'Banana', 'price' => 20],
            ['id' => 3, 'name' => 'Cherry', 'price' => 3],
        ]);
        // Or: new ArrayDataProvider(collect($rows)), new ArrayDataProvider($someApiClient->getItems())

        return view('example-view', [
            'dataProvider' => $dataProvider
        ]);
    }
}

Sorting, filtering and pagination work the same way as with EloquentDataProvider, but they are made in memory:

  • the text filter searches a part of the value without case sensitivity (like SQL like);
  • if strictFilters = true, the value must be equal;
  • sorting compares values as they are (numbers as numbers, strings as strings).

Note! All rows are kept in memory. For big data (thousands of rows and more) use EloquentDataProvider, it takes from a database only one page.

View template part

Use @gridView() directive with config array in a blade view template.

Simple quick usage

You can simply set columns to display as string format in columnFields array.

Note:

There search filter fields are displayed automatically. By default text form field filters are used.

If you don't want to use search filters, set useFilters = false.

@php
$gridData = [
    'dataProvider' => $dataProvider,
    'title' => 'Panel title',
    'useFilters' => false,
    'columnFields' => [
        'id',
        'active',
        'icon',
        'created_at'
    ]
];
@endphp
@gridView($gridData)

Alternative variant without a blade directive:

{!! grid_view([
    'dataProvider' => $dataProvider,
    'useFilters' => false,
    'columnFields' => [
        'id',
        'active',
        'icon',
        'created_at'
    ]
]) !!}

Setting custom options

Main columns

Simple example:

@gridView([
    'dataProvider' => $dataProvider,
    'columnFields' => [
        [
            'label' => 'First Name', // Column label.
            'attribute' => 'first_name', // Attribute, by which the row column data will be taken from a model.
        ],
        [
            'label' => 'Last Name',
            'value' => function ($row) {
                return $row->last_name;
            }
            'sort' => 'last_name' // To sort rows. Have to set if an 'attribute' is not defined for column.
        ],
    ]
])
Special columns

Besides main columns, there can be the next special columns:

  • ActionColumn - is for displaying Buttons to view, edit and delete rows.

    Set 'class' => Itstructure\GridView\Columns\ActionColumn::class in column option

    There are the next required actionTypes:

    • view - makes a link for viewing. Default url scheme: url()->current() . '/' . $row->id . '/delete'.
    • edit - makes a link for edition. Default url scheme: url()->current() . '/' . $row->id . '/edit'.
    • delete - makes a link for deletion. Default url scheme: url()->current() . '/' . $row->id . '/delete'.

    They can be simple strings, arrays or callbacks.

    For array format it is necessary set class. And optional: url, htmlAttributes. The class can be a built-in action or your own action (see Custom action below).

    By callback you can change urls to your routes.

    Simple example for a column config:

    @gridView([
        'dataProvider' => $dataProvider,
        'columnFields' => [
            [
                'label' => 'Actions', // Optional
                'class' => Itstructure\GridView\Columns\ActionColumn::class, // Required
                'actionTypes' => [ // Required
                    'view',
                    'edit' => function ($data) {
                        return '/admin/pages/' . $data->id . '/edit';
                    },
                    [
                        'class' => Itstructure\GridView\Actions\Delete::class, // Required
                        'url' => function ($data) { // Optional
                            return '/admin/pages/' . $data->id . '/delete';
                        },
                        'htmlAttributes' => [ // Optional
                            'target' => '_blank',
                            'style' => 'color: yellow; font-size: 16px;',
                            'onclick' => 'return window.confirm("Are you sure you want to delete?");'
                        ]
                    ]
                ]
            ]
        ]
    ])

    Custom action. You can add your own button, for example "Log". Create a class, which extends Itstructure\GridView\Actions\BaseAction, and implement two methods: render() (the button html) and buildUrl() (the default url).

    1. Create the action class, for example app/GridActions/LogAction.php:

      namespace App\GridActions;
      
      use Itstructure\GridView\Actions\BaseAction;
      
      class LogAction extends BaseAction
      {
          public function render($row, int $bootstrapColWidth = BaseAction::BOOTSTRAP_COL_WIDTH)
          {
              return '<div class="col-lg-' . $bootstrapColWidth . '">'
                  . '<a class="btn btn-info" href="' . e($this->getUrl($row)) . '" ' . $this->buildHtmlAttributes() . '>Log</a>'
                  . '</div>';
          }
      
          protected function buildUrl($row)
          {
              return url('/items/' . $row->id . '/log');
          }
      }
    2. Add it to actionTypes as an array with class:

      'actionTypes' => [
          'view',
          'edit',
          [
              'class' => App\GridActions\LogAction::class,
              'htmlAttributes' => ['target' => '_blank'], // Optional
          ],
      ]

    The url can also be set by a callback, then buildUrl() is not used:

    [
        'class' => App\GridActions\LogAction::class,
        'url' => function ($row) {
            return route('items.log', ['id' => $row->id]);
        },
    ]

    Instead of html in a string, render() can also return a blade view, as the built-in actions do (see src/Actions/View.php and resources/views/actions/view.blade.php).

  • CheckboxColumn - is for displaying Checkboxes to multiple choose the rows.

    Set 'class' => Itstructure\GridView\Columns\CheckboxColumn::class in column option

    There are the next required options:

    • field - is for a name checkbox input attribute. It is rendered as an array name="{{ $field }}[]".
    • attribute - is for a value checkbox input attribute. It is rendered as: value="$row->{$this->attribute}".

    Simple example for a column config:

    @gridView([
        'dataProvider' => $dataProvider,
        'columnFields' => [
            [
                'class' => Itstructure\GridView\Columns\CheckboxColumn::class,
                'field' => 'delete',
                'attribute' => 'id'
            ]
        ]
    ])

    Note! Since version 1.3.0 checkboxes have a normal size. Before they were bigger, because of form-control class. But this class is not for checkboxes, and in Bootstrap 5 it hides them.

    If you want bigger checkboxes, add CSS to your application, for example:

    #grid_view_checkbox_main,
    input[role="grid-view-checkbox-item"] {
        width: 1.25rem;
        height: 1.25rem;
    }
Filters

There are the next filter's variants:

  • Column option to switch off the filter:

    'filter' => false
  • TextFilter - is a default filter, which renders a text form field to search, using column attribute.

  • DropdownFilter - is a filter, which renders <select> html tag.

    Keys and titles of data array are escaped, so html tags in titles are shown as text.

    Set the next as column option:

    @gridView([
        'dataProvider' => $dataProvider,
        'columnFields' => [
            [
                'attribute' => 'example_attribute',
                'filter' => [
                    'class' => Itstructure\GridView\Filters\DropdownFilter::class,
                    'data' => ['key' => 'value', 'key' => 'value'] // Array keys are for html <option> tag values, array values are for titles.
                ]
            ]
        ]
    ])

    If attribute is not defined for column or you want to set a special filter field name:

    @gridView([
        'dataProvider' => $dataProvider,
        'columnFields' => [
            [
                'filter' => [
                    'class' => Itstructure\GridView\Filters\DropdownFilter::class,
                    'name' => 'example_name',
                    'data' => ['key' => 'value', 'key' => 'value'] // Array keys are for html <option> tag values, array values are for titles.
                ]
            ]
        ]
    ])
Formatters

There are the next formatter keys:

  • html - is for passing a row content with html tags.

    Note! The value is displayed as is, without escaping. Use it only for data, which you trust.

  • image - is for inserting a row data in to src attribute of <img> tag. The value is escaped.

  • text - applies strip_tags() for a row data, then escapes special html characters (&, <, >, quotes). Already escaped entities (like &amp;) are not escaped twice. This is a default formatter.

    If you set allowableTags option (for example 'allowableTags' => '<b><i>'), these tags are kept and the value is not escaped.

  • url - is for inserting a row data in to href attribute of <a> tag. The value is escaped. The title option is not escaped, so you can use html in it (an icon, for example).

For that keys there are the next formatters:

  • HtmlFormatter
  • ImageFormatter
  • TextFormatter
  • UrlFormatter

Also you can set formatter with some addition options. See the next simple example:

@gridView([
    'dataProvider' => $dataProvider,
    'columnFields' => [
        [
            'attribute' => 'url',
            'format' => [
                'class' => Itstructure\GridView\Formatters\UrlFormatter::class,
                'title' => 'Source',
                'htmlAttributes' => [
                    'target' => '_blank'
                ]
            ]
        ],
        [
            'attribute' => 'content',
            'format' => 'html'
        ]
    ]
])
Existing form areas and main buttons

Grid view forms

There are two main form areas:

  • grid_view_filters_form

    Two buttons affect search request submission:

    • Search. You can change a button label by option: searchButtonLabel.
    • Reset. You can change a button label by option: resetButtonLabel.

    If useFilters = false, these buttons will not be displayed.

  • grid_view_rows_form

    You can set a specific action attribute value by option rowsFormAction.

    One button affect a main submit request:

    • Send. You can change a button label by option: sendButtonLabel.

      Note! This button will be displayed under one of two conditions:

      • There is a checkbox column.
      • Option useSendButtonAnyway = true.
Rows
  • Serial column. By default the first column of the table shows a row serial number (#). To hide it, set useSerialColumn = false:

    @gridView([
        'dataProvider' => $dataProvider,
        'useSerialColumn' => false,
        'columnFields' => ['id', 'name']
    ])
  • Row html attributes. Option rowOptions sets html attributes of a table row (<tr>). It can be an array (the same attributes for all rows) or a callback function, which gets a row and returns an array. Values are escaped.

    'rowOptions' => function ($row) {
        return [
            'class' => $row->active ? null : 'table-secondary', // null - the attribute is not added
            'data-id' => $row->id,
        ];
    },
  • Clickable rows. Option rowUrl is a callback function, which gets a row and returns an url. A click on a row opens this url (with Ctrl or Cmd key - in a new tab). The mouse cursor over the rows is a pointer (hand).

    Clicks on links, buttons and form fields inside a row (for example action buttons and checkboxes) work as before and do not open the row url.

    'rowUrl' => function ($row) {
        return route('items.show', ['id' => $row->id]);
    },
Filters and sorting from the url

The grid takes filters and sorting from the url, for example: /items?filters[name]=apple&sort=-price.

For security, only those filters and sorts are accepted, which belong to the grid columns:

  • A filter is accepted, if a column of the grid has this filter. By default the filter name is the column attribute. If you set name in the filter config, then this name.
  • A sort is accepted, if a column of the grid has this sort. By default it is the column attribute. If you set sort option for the column, then this sort.

All other filters and sorts in the url are ignored. Without this anybody could filter or sort the rows by any table column, even by a column, which is not displayed (a password hash, for example), just changing the url.

Note! If a column has 'filter' => false, a filter by this column from the url is ignored. If useFilters = false, all filters from the url are ignored, because there are no filters in the grid.

If you need a filter or a sort by a column, which is not displayed in the grid, allow it by allowedFilters and allowedSorts options.

For example, there is a link /items?filters[category_id]=5&sort=-created_at from a category page, but there are no category_id and created_at columns in the grid:

@gridView([
    'dataProvider' => $dataProvider,
    'allowedFilters' => ['category_id'], // Filters, which are allowed from the url besides the filters of the grid columns.
    'allowedSorts' => ['created_at'], // Sorts, which are allowed from the url besides the sorts of the grid columns.
    'columnFields' => [
        'id',
        'name'
    ]
])

Note! Before version 1.2.0 any filter and any sort from the url were accepted. If your links use filters or sorts by columns, which are not in the grid, add them to allowedFilters / allowedSorts after the update.

Complex extended example
@php
$gridData = [
    'dataProvider' => $dataProvider,
    'paginatorOptions' => [ // Here you can set some options of paginator Illuminate\Pagination\LengthAwarePaginator, used in a package.
        'pageName' => 'p'
    ],
    'rowsPerPage' => 5, // The number of rows in one page. By default 10.
    'title' => 'Panel title', // It can be empty ''
    'strictFilters' => true, // If true, then a searching by filters will be strict, using an equal '=' SQL operator instead of 'like'.
    'useSerialColumn' => false, // If false, the first column with a row serial number ("#") is not displayed. By default true.
    'rowOptions' => ['class' => 'grid-row'], // Html attributes of a table row. An array or a callback function ($row), which returns an array.
    'rowUrl' => function ($row) { // A click on a row opens this url.
        return '/admin/pages/' . $row->id;
    },
'allowedFilters' => ['category_id'], // Filters, which are allowed from the url besides the filters of the grid columns. See "Filters and sorting from the url".
    'allowedSorts' => ['updated_at'], // Sorts, which are allowed from the url besides the sorts of the grid columns. See "Filters and sorting from the url".
    'rowsFormAction' => '/admin/pages/deletion', // Route url to send slected checkbox items for deleting rows, for example.
    'useSendButtonAnyway' => true, // If true, even if there are no checkbox column, the main send button will be displayed.
    'searchButtonLabel' => 'Find',
    'columnFields' => [
        [
            'attribute' => 'id', // REQUIRED if value is not defined. Attribute name to get row column data.
            'label' => 'ID', // Column label.
            'filter' => false, // If false, then column will be without a search filter form field.,
            'htmlAttributes' => [
                'width' => '5%' // Width of table column.
            ]
        ],
        [
            'label' => 'Active', // Column label.
            'value' => function ($row) { // You can set 'value' as a callback function to get a row data value dynamically.
                return '<span class="icon fas '.($row->active == 1 ? 'fa-check' : 'fa-times').'"></span>';
            },
            'filter' => [ // For dropdown it is necessary to set 'data' array. Array keys are for html <option> tag values, array values are for titles.
                'class' => Itstructure\GridView\Filters\DropdownFilter::class, // REQUIRED. For this case it is necessary to set 'class'.
                'name' => 'active', // REQUIRED if 'attribute' is not defined for column.
                'data' => [ // REQUIRED.
                    0 => 'No active',
                    1 => 'Active',
                ]
            ],
            'format' => 'html', // To render column content without lossless of html tags, set 'html' formatter.
            'sort' => 'active' // To sort rows. Have to set if an attribute is not defined for column.
        ],
        [
            'label' => 'Icon', // Column label.
            'value' => function ($row) { // You can set 'value' as a callback function to get a row data value dynamically.
                return $row->icon;
            },
            'filter' => false, // If false, then column will be without a search filter form field.
            'format' => [ // Set special formatter. If $row->icon value is a url to image, it will be inserted in to 'src' attribute of <img> tag.
                'class' => Itstructure\GridView\Formatters\ImageFormatter::class, // REQUIRED. For this case it is necessary to set 'class'.
                'htmlAttributes' => [ // Html attributes for <img> tag.
                    'width' => '100'
                ]
            ]
        ],
        'created_at', // Simple column setting by string.
        [ // Set Action Buttons.
            'class' => Itstructure\GridView\Columns\ActionColumn::class, // REQUIRED.
            'actionTypes' => [ // REQUIRED.
                'view',
                'edit' => function ($data) {
                    return '/admin/pages/' . $data->id . '/edit';
                },
                [
                    'class' => Itstructure\GridView\Actions\Delete::class, // REQUIRED
                    'url' => function ($data) {
                        return '/admin/pages/' . $data->id . '/delete';
                    },
                    'htmlAttributes' => [
                        'target' => '_blank',
                        'style' => 'color: yellow; font-size: 16px;',
                        'onclick' => 'return window.confirm("Sure to delete?");'
                    ]
                ]
            ]
        ],
        [
            // For this case checkboxes will be rendered according with: <input type="checkbox" name="delete[]" value="{{ $row->id }}" />
            'class' => Itstructure\GridView\Columns\CheckboxColumn::class, // REQUIRED.
            'field' => 'delete', // REQUIRED.
            'attribute' => 'id' // REQUIRED.
            'display' => function ($row) {
                return {...condition to return true for displaying...};
            }
        ]
    ]
];
@endphp
@gridView($gridData)

Tests

The package has its own tests. They check columns, filters, sorting, pagination, formatters and the @gridView directive.

Good to know before you start:

  • The tests do not need a database server and do not need a .env file. They use SQLite in memory, everything is created and deleted automatically.
  • The tests work on all supported versions: PHP 7.1 ... 8.5 and Laravel 5.5 ... 13.
  • When you install dependencies of the package, the vendor folder and the composer.lock file appear in the package folder. It is normal. They are in .gitignore, so they will not get into git.

Below there are several ways to run the tests. Choose the one, which fits you.

Way 1. You have PHP and Composer on your computer

  1. Get the package source code.

    If you have git, run command:

    git clone https://github.com/itstructure/laravel-grid-view.git

    If you do not have git, open https://github.com/itstructure/laravel-grid-view, press the green Code button, then Download ZIP, and unpack the archive.

  2. Go to the package folder:

    cd laravel-grid-view

  3. Install dependencies (it is enough to do it once):

    composer install

    Composer itself chooses the Laravel and PHPUnit versions, which fit your PHP version.

    Note! PHP must have pdo_sqlite and mbstring extensions. Usually they are already enabled. If not, Composer or the tests will tell you about it.

  4. Run the tests:

    composer test

    Or the same directly:

    • Linux / macOS: vendor/bin/phpunit
    • Windows: vendor\bin\phpunit
  5. If you want to run only one test, add --filter with the test name:

    vendor/bin/phpunit --filter test_pagination

If everything is fine, you will see a message like: OK (51 tests, 133 assertions).

Way 2. You have nothing except Docker

You do not need to install PHP and Composer. Docker downloads them by itself.

  1. Get the package source code and go to the package folder, as in steps 1 and 2 of Way 1.

  2. Install dependencies (it is enough to do it once).

    For Linux, macOS and WSL terminal:

    docker run --rm --user "$(id -u):$(id -g)" -e COMPOSER_HOME=/tmp/composer -v "$PWD":/app -w /app composer:2 composer update --no-interaction

    For Windows PowerShell:

    docker run --rm -v "${PWD}:/app" -w /app composer:2 composer update --no-interaction

    Here:

    • --user "$(id -u):$(id -g)" - files in the vendor folder will belong to you, not to the root user. In Windows PowerShell it is not needed.
    • -v "$PWD":/app - the current folder (package folder) is available inside the container as /app.
  3. Run the tests.

    For Linux, macOS and WSL terminal:

    docker run --rm --user "$(id -u):$(id -g)" -v "$PWD":/app -w /app php:8.4-cli php vendor/bin/phpunit

    For Windows PowerShell:

    docker run --rm -v "${PWD}:/app" -w /app php:8.4-cli php vendor/bin/phpunit

    To run only one test, add --filter test_name to the end of the command.

Note! In step 2 Composer installs the newest versions of Laravel and PHPUnit. They need a new PHP, so in step 3 use php:8.4-cli or newer. To check an old PHP or Laravel version, see Way 3.

Way 3. Check a specific PHP and Laravel version with Docker

It is useful, when you want to make sure that the package works for example on PHP 7.3 with Laravel 8.

  1. Choose a pair of versions from the table:

    PHP image Laravel Testbench
    php:7.1-cli 5.5.* 3.5.*
    php:7.2-cli 5.8.* 3.8.*
    php:7.2-cli 6.* 4.*
    php:7.3-cli 7.* 5.*
    php:7.3-cli 8.* 6.*
    php:8.0-cli 9.* 7.*
    php:8.1-cli 10.* 8.*
    php:8.2-cli 11.* 9.*
    php:8.3-cli 12.* 10.*
    php:8.3-cli 13.* 11.*

    Testbench (orchestra/testbench) is a tool for testing Laravel packages. Each Laravel version needs its own Testbench version, that is why it is in the table.

  2. Go to the package folder. If you have already installed dependencies before, delete the vendor folder and the composer.lock file.

  3. Install dependencies for the chosen pair. Example for PHP 7.3 + Laravel 8 (Linux, macOS, WSL terminal):

    docker run --rm --user "$(id -u):$(id -g)" -e COMPOSER_HOME=/tmp/composer -v "$PWD":/app -w /app composer:2 sh -c "composer config platform.php 7.3.33 && composer config policy.advisories.block false && composer require --no-update 'laravel/framework:8.*' && composer require --dev --no-update 'orchestra/testbench:6.*' && composer update --no-interaction --no-plugins"

    What this command does:

    • composer config platform.php 7.3.33 - tells Composer to choose packages for PHP 7.3, because Composer itself works on a newer PHP inside its container.
    • composer config policy.advisories.block false - allows installing old Laravel versions. New Composer refuses to install versions with known security advisories. It is OK for running tests, but never do it in a real project.
    • composer require --no-update ... - sets the chosen Laravel and Testbench versions.
    • --no-plugins - old Laravel versions bring Composer plugins, which are not needed for tests and are blocked by new Composer.

    For another pair, change 7.3.33, 8.* and 6.* to the values from the table. For platform.php you can write any version of the chosen PHP, for example 7.1.33, 8.0.30, 8.2.0.

  4. Run the tests with the PHP image from the table:

    docker run --rm --user "$(id -u):$(id -g)" -v "$PWD":/app -w /app php:7.3-cli php vendor/bin/phpunit
  5. Important! The command in step 3 changes the composer.json file of the package. When you finish, return it back and delete the installed files:

    git checkout composer.json

    And delete the vendor folder and the composer.lock file.

    If you downloaded the package as ZIP (without git), just download and unpack it again.

Way 4. Automatic tests on GitHub

You do not need to do anything. After each push and each pull request, GitHub runs the tests by itself on all version pairs from the table above (and a few more).

Results are on the Actions tab of the repository: https://github.com/itstructure/laravel-grid-view/actions

Green check mark - all tests passed. Red cross - something is broken, open it to see the details.

The settings are in the .github/workflows/tests.yml file.

If the package is installed in your Laravel project

  1. Your project tests and the package tests do not mix.

    When you run tests of your project (composer test, php artisan test or vendor/bin/phpunit in the project folder), only tests of your project are run. The project phpunit.xml file points to the project tests folder, and the package lies in vendor/itstructure/laravel-grid-view. So the package tests are not run there.

  2. Usually there are no package tests in your project at all.

    By default Composer downloads the package as an archive. The tests folder, the .github folder and the phpunit.xml.dist file are excluded from this archive (see the .gitattributes file), because they are not needed for the package to work. So in vendor/itstructure/laravel-grid-view there is only the package itself.

  3. Exception: installation with --prefer-source.

    If the package is installed with --prefer-source (Composer makes git clone instead of downloading an archive), or from a local folder (see "If you are testing this package from a local server directory" above), then the whole repository is in the project, the tests too.

    It does not break anything: your project tests still do not run them.

  4. How to run the package tests in this case.

    Do not run them through your project, the project has no tools needed for the package tests.

    Run them in the package folder itself, as described in Way 1 or Way 2:

    • If the package is installed from a local folder ("type": "path"), go to that local folder, for example ../laravel-grid-view.
    • Otherwise, just clone the package repository to a separate folder.

License

Copyright © 2020-2026 Andrey Girnik girnikandrey@gmail.com.

Licensed under the MIT license. See LICENSE.txt for details.