Download the PHP package aliziodev/laravel-taxonomy without Composer

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

Laravel Taxonomy

Tests Code Quality Latest Version on Packagist Total Downloads License PHP Version Laravel Version

Laravel Taxonomy is a flexible and powerful package for managing taxonomies, categories, tags, and hierarchical structures in Laravel applications. Features nested-set support for optimal query performance on hierarchical data structures.

📖 Documentation

📋 Table of Contents

Overview

This package is ideal for:

Key Features

Core Functionality

Nested Set Features

Performance & Scalability

Developer Experience

Requirements

Installation

Via Composer

Publish Configuration and Migrations

You can publish the configuration and migrations using the provided install command:

Or manually:

Run Migrations

⚙️ Configuration

After publishing the configuration file, you can customize it in config/taxonomy.php. Here's a detailed explanation of each option:

Configuration Options Explained

Table Names

Customize database table names if you need to avoid conflicts or follow specific naming conventions:

Morph Type

Choose the appropriate morph type based on your model's primary key:

Custom Types

Extend or replace the default taxonomy types:

Slug Configuration

Control slug generation behavior:

Important: Composite Unique Constraint

Starting from version 2.3.0, slugs are unique within their taxonomy type, not globally. This means:

🚀 Quick Start

Get up and running with Laravel Taxonomy in minutes:

1. Create Your First Taxonomy

2. Associate with Models

3. Query and Filter

📖 Basic Usage

Working with the Taxonomy Facade

The Taxonomy facade provides a clean, expressive API for all taxonomy operations:

Working with Model Relationships

Once you've added the HasTaxonomy trait to your models, you get access to powerful relationship methods:

Query Scopes for Filtering

Filter your models using powerful query scopes:

Scope Chaining vs Single Scope with Type

With the composite unique constraint, you have two approaches for filtering:

Pagination Support

The package supports pagination for search and find methods:

Complete Controller Example

Here's a comprehensive example of using Laravel Taxonomy in a controller:

🌳 Hierarchical Data & Nested Sets

Laravel Taxonomy uses the Nested Set Model for efficient hierarchical data management:

Understanding Nested Sets

The nested set model stores hierarchical data using lft (left) and rgt (right) values, along with depth for each node. This allows for efficient querying of hierarchical relationships.

Tree Operations

📊 Metadata Support

Store additional data with each taxonomy using JSON meta:

🔄 Bulk Operations

Efficiently manage multiple taxonomy relationships:

Basic Bulk Operations

Advanced Bulk Management

⚡ Caching & Performance

Laravel Taxonomy includes intelligent caching for optimal performance:

Automatic Caching

Manual Cache Management

Performance Tips

🏷️ Custom Taxonomy Types

While the package comes with predefined taxonomy types in the TaxonomyType enum (Category, Tag, Color, Size, etc.), you can easily define and use your own custom types.

Defining Custom Types

There are two ways to use custom taxonomy types:

1. Override the types configuration

You can override the default types by modifying the types array in your config/taxonomy.php file:

2. Use custom types directly

You can also use custom types directly in your code without modifying the configuration:

Creating a Custom Type Enum

For better type safety and organization, you can create your own enum for custom types:

Then use it in your code:

🎯 Real-World Usage Scenarios

For comprehensive examples of how to use Laravel Taxonomy in real-world applications, please refer to our detailed scenario documentation:

Available Scenarios

  1. E-commerce Product Catalog - Building a comprehensive e-commerce platform with hierarchical categories, product tags, dynamic navigation, and advanced filtering.

  2. Content Management System - Creating a flexible CMS with content categorization, tagging, filtering, and SEO optimization.

  3. Learning Management System - Developing an educational platform with courses, skills, difficulty levels, and personalized learning paths.

  4. Multi-tenant Business Application - Building a SaaS platform with tenant-specific taxonomies, project management, and customizable workflows.

  5. Analytics and Reporting - Implementing comprehensive analytics, reporting dashboards, and automated insights using taxonomy data.

Each scenario includes:

🚀 Advanced Features

🔄 Nested Set Model

Laravel Taxonomy uses the Nested Set Model for efficient hierarchical data management:

Performance Optimization

Caching Strategies:

Eager Loading for Performance:

Advanced Querying

Complex Taxonomy Filters:

Data Import/Export

Import/Export Functionality:

📋 Best Practices

1. Taxonomy Design Principles

2. Metadata Best Practices

3. Performance Optimization

4. Error Handling and Validation

5. Testing Strategies

Custom Slugs and Error Handling

The package provides robust error handling for slug generation and uniqueness:

Manual Slug Management

When slugs.generate is set to false in the configuration, you must provide slugs manually:

Slug Uniqueness (Composite Unique)

Starting from v3.0, slug uniqueness is enforced within the same taxonomy type (composite unique constraint):

Duplicate Slug Detection

Exception Handling

The package provides the following exceptions:

You can catch these exceptions to provide custom error handling:

Troubleshooting

Common Issues

Taxonomy Not Found

If you're having trouble finding a taxonomy by slug, make sure the slug is correct and consider using the exists method to check if it exists:

Relationship Issues

If you're having trouble with relationships, make sure you're using the correct morph type in your configuration. If you're using UUIDs or ULIDs for your models, make sure to set the morph_type configuration accordingly.

Cache Issues

If you're not seeing updated data after making changes, you might need to clear the cache:

Security

The Laravel Taxonomy package follows good security practices:

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

Testing

The package includes comprehensive tests. You can run them with:

📝 Automatic Changelog

This package uses automated changelog generation based on Conventional Commits and Semantic Versioning.

How It Works

Commit Message Format

Examples:

Release Types

Commit Type Release Type Example
fix: Patch (1.0.1) Bug fixes
feat: Minor (1.1.0) New features
feat!: or BREAKING CHANGE: Major (2.0.0) Breaking changes
docs:, style:, test:, chore: No Release Documentation, formatting

Automated Workflows

Contributing

Please see CONTRIBUTING for details on our automated changelog system and development workflow.

License

The Laravel Taxonomy package is open-sourced software licensed under the MIT license.


All versions of laravel-taxonomy with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
laravel/framework Version ^11.0|^12.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 aliziodev/laravel-taxonomy contains the following files

Loading the files please wait ....