定制 bipinkareparambil/laravel-where-like-any 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bipinkareparambil/laravel-where-like-any

最新稳定版本:v1.0.0

Composer 安装命令:

composer require bipinkareparambil/laravel-where-like-any

包简介

Adds whereLikeAny, whereLikeAll, whereNotLikeAny, whereNotLikeAll (and or* variants) to Laravel's query builder.

README 文档

README

Adds symmetric "one column, multiple patterns" LIKE filtering to Laravel's query builder, complementing the built-in whereAny / whereAll (which handle "multiple columns, one pattern").

Install

composer require bipinkareparambil/laravel-where-like-any

The service provider auto-registers. The new methods are available on Illuminate\Database\Query\Builder and, by extension, Eloquent builders.

Methods

Method SQL
whereLikeAny($col, $values) (col LIKE ? OR col LIKE ?)
whereNotLikeAny($col, $values) (col NOT LIKE ? AND col NOT LIKE ?)
whereLikeAll($col, $values) (col LIKE ? AND col LIKE ?)
whereNotLikeAll($col, $values) (col NOT LIKE ? OR col NOT LIKE ?)

Plus or variants: orWhereLikeAny, orWhereNotLikeAny, orWhereLikeAll, orWhereNotLikeAll.

All methods accept a $caseSensitive flag. Under the hood each call delegates to whereLike, so MySQL like binary, Postgres ilike, and SQLite glob all work automatically — no grammar changes.

Usage

// Match any pattern
User::whereLikeAny('name', ['%john%', '%jane%'])->get();

// Match all patterns
User::whereLikeAll('bio', ['%laravel%', '%php%'])->get();

// Exclude any pattern
User::whereNotLikeAny('email', ['%spam%', '%temp%'])->get();

// Case-sensitive on MySQL
User::whereLikeAny('name', ['%John%'], caseSensitive: true)->get();

Negation semantics (De Morgan's)

  • whereNotLikeAny negates "match any" → flips OR to AND.
  • whereNotLikeAll negates "match all" → flips AND to OR.

Tests

composer install
vendor/bin/phpunit

Why a package?

Originally proposed to Laravel core in laravel/framework#59725. Released as a package per maintainer preference to keep the core surface area small.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固