承接 priblo/laravel-has-tags 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

priblo/laravel-has-tags

Composer 安装命令:

composer require priblo/laravel-has-tags

包简介

Performance centric model tags trait

README 文档

README

Performance centric model tags trait

Build Status

Trait Usage

Add the trait to any Eloqent model you need to become taggable:

Priblo\LaravelHasTags\Traits\HasTags;

Usage:

$Post = new Post();

// Tag Model
// (Duplicates are automatically handled)
$Post->tag(['tag1', 'tag2', 'tag3', 'tag1']);
// Tag Model with type
$Post->tag(['tag1', 'tag2', 'tag3', 'tag1'], 'hashtag');

// Count ALL tags attached to the model
$Post->tags->count()
// Count ONLY tags with type
$Post->tagsWithType('hashtag')->count()

// Retag model
// Will remove previous tags and add the new ones
// Type is optional
$Post->reTag(['tag5', 'tag6'],'hashtag');
// Removes ALL tags without type from Model
$Post->untag()
// Removes ONLY tags with the specified type from Model
$Post->untag('hashtag')
// Removes ALL tags from model
$Post->untagALL()

// Retrieves all tagged models with the specified tag and type (optional)
$posts = Post::withAnyTag(['tag1'],'hashtag')->get();

// Retrieves all related models according to Tag and type (optional)
// Returns a collection of Priblo\LaravelHasTags\Models\Related
$relatedCollection = Post::getRelatedByTag('tag1', 'hashtag));

Note on types

Every tag has a type, which if unspecified will be NULL, a null type is still a type, which means that using the untag() method will remove ONLY tags with type === NULL. This is a design choice.

Config

Cache

Caching requires a driver which supports tags. File and Database won't work, redis is suggested. Please make sure to either disable caching in the config or use the array driver for local development.

In the has-tags.php config file you can enable/disable caching and set the cache expiration time.

Caching is enabled by default

Install

Requires: Laravel >=5.5 and PHP 7.1

Composer

    composer require priblo/laravel-has-tags

Laravel

This package supports Auto Discovery.

If you have disabled it, you can install this package by adding to the 'providers' array in ./config/app.php

Priblo\LaravelHasTags\LaravelServiceProvider::class,

Then run:

php artisan vendor:publish --provider="Priblo\LaravelHasTags\LaravelServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="Priblo\LaravelHasTags\LaravelServiceProvider" --tag="config"

Then migrate:

php artisan migrate

Why another tagging trait?

At Priblo we couldn't find a suitable tagging trait for Laravel. Each one fell short for some reason or another. Mainly in the performance department. Tags are an important part of Priblo and we needed to get them right. Opting for the Decorator pattern we put an emphasis on caching and performance. We considered contributing to other projects, but none were in line with our design philosophy. So here it is our implementation, hoping it will be useful to someone else.

priblo/laravel-has-tags 适用场景与选型建议

priblo/laravel-has-tags 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「tags」 「tag」 「tagging」 「laravel」 「eloquent」 「hashtag」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 priblo/laravel-has-tags 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 priblo/laravel-has-tags 我们能提供哪些服务?
定制开发 / 二次开发

基于 priblo/laravel-has-tags 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-13