Download the PHP package tatter/menus without Composer

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

Tatter\Menus

Dynamic menus for CodeIgniter 4

Coverage Status

Quick Start

  1. Install with Composer: > composer require tatter/menus
  2. Create your menus by extending Tatter\Menus\Menu
  3. Add your menu aliases to Config\Menus
  4. Apply MenuFilter to all routes that need menus

Features

Menus provides dynamic menus across your application. Menus organizes and injects the menu content, so you can focus on building.

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Configuration (optional)

The library's default behavior can be altered by extending its config file. Copy examples/Menus.php to app/Config/ and follow the instructions in the comments. If no config file is found in app/Config the library will use its own.

Usage

Building

Menus is built on Spatie\Menu with all of its wonderful, dynamic and fluent functionality. Use their documentation to craft your menus as simple or complex as you like:

Create your menus by extending Tatter\Menus\Menu. You will notice in the source code that Menu requires you to provide one method: public function __toString(): string;. You may use the supplied $builder property to access the underlying Spatie\Menu to build your menu, or provide your own HTML code or view() return. Some examples:

Note: $builder is initialized with "set active" to the current URL. You may call setActive() again to remove or change the active menu item. Due to a limitation in Spatie\Menu with mixing relative and absolute URLs you must supply full URL values (e.g. with site_url()) to your Menu if you want to use this default "active" URL.

Deploying

Since Menu is Stringable it can be used in your view or layout files as is. However, Menus also comes with a Controller Filter that you can use to inject menu content directly into your responses. First you need to create an alias for each Menu class you would like to use. Create app/Config/Menus.php (or start with a copy from the examples folder) and add your menu classes to the $aliases array. For example:

Once aliases are set up you can pass them as an argument to the MenuFilter for any route:

Then in your view or layout put the placeholder token with the name of the alias target in double curly braces:

Note that sometimes it is preferable to apply the filter in bulk using app/Config/Filters.php. Unfortunately parameters are not yet supported in Config\Filters, but you can work around this by creating your own parameter-specific Filter:

Packaged Menus

Menus comes with some pre-made menus which can be used immediately or built on to create your own variants. All menus are in the Tatter\Menus\Menus namespace and extend the Menu class so can be used with the Filter or as any other menu you would make.

Breadcrumbs

The BreadcrumbsMenu is a special menu, using horizontal-style navigation links for nested content. This menu comes pre-styled for Bootstrap and defaults to the segments retrieved from the framework's IncomingRequest::$uri, but you may provide your own using the static methods set, get, push, and pop. Additionally, BreadcrumbsMenu::discover() will attempt to create a default menu. All these methods use the Breadcrumb class, a simple wrapper for the URL and display value. For example:

... if you have the filter in place the rest is handled for you.


All versions of menus with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
spatie/menu Version ^2.10 || ^3.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 tatter/menus contains the following files

Loading the files please wait ....