Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/michalsn/codeigniter-tags

Tags functionality for Codeigniter 4 framework
https://github.com/michalsn/codeigniter-tags

codeigniter codeigniter4 php php81 tags

Last synced: 4 days ago
JSON representation

Tags functionality for Codeigniter 4 framework

Awesome Lists containing this project

README

        

# CodeIgniter Tags

A library that helps you build **tags** functionality around your existing models in the CodeIgniter 4 framework.

[![PHPUnit](https://github.com/michalsn/codeigniter-tags/actions/workflows/phpunit.yml/badge.svg)](https://github.com/michalsn/codeigniter-tags/actions/workflows/phpunit.yml)
[![PHPStan](https://github.com/michalsn/codeigniter-tags/actions/workflows/phpstan.yml/badge.svg)](https://github.com/michalsn/codeigniter-tags/actions/workflows/phpstan.yml)
[![Deptrac](https://github.com/michalsn/codeigniter-tags/actions/workflows/deptrac.yml/badge.svg)](https://github.com/michalsn/codeigniter-tags/actions/workflows/deptrac.yml)
[![Coverage Status](https://coveralls.io/repos/github/michalsn/codeigniter-tags/badge.svg?branch=develop)](https://coveralls.io/github/michalsn/codeigniter-tags?branch=develop)

![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue)

## Installation

composer require michalsn/codeigniter-tags

Migrate your database:

php spark migrate --all

## Configuration

Add `HasTags` trait to your model and initialize tags with `initTags()` method.

```php
class ExampleModel extends BaseModel
{
use HasTags;

// ...

protected function initialize()
{
$this->initTags();
}

// ...
}
```

And if you use [Entity](https://www.codeigniter.com/user_guide/models/entities.html) class, add `TaggableEntity` trait to it:

```php
class Example extends Entity
{
use TaggableEntity;

// ...
}
```

## Docs

https://michalsn.github.io/codeigniter-tags/