A tidy conditional Blade directive for checking if something is in an array

Overview

A tidy conditional Blade directive for checking if something is in an array.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a small @in directive that allows you to simplify in_array checks inside of your Blade views.

Installation

You can install the package via Composer:

composer require ryangjchandler/blade-in-directive

Usage

You can use the @in directive in the same way as the @if directive.

@in('foo', ['foo', 'bar'])
    Hey, I found it.
@endin

Behind the scenes, it's being simplified to an if (in_array('foo', ['foo', 'bar'])) statement.

You can also do strict checks by providing a third bool argument to the directive.

@in('1', [1, 2], true)
    This never gets rendered. Strings aren't integers.
@endif

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

You might also like...
Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.
Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.

Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.

Your alter ego object. Takes the best of object and array worlds.

Supporting Opensource formapro\values is an MIT-licensed open source project with its ongoing development made possible entirely by the support of com

World Currency list in PHP constants and in array (Currency::USD)
World Currency list in PHP constants and in array (Currency::USD)

World Currency list in PHP constants and in array (Currency::USD) If you need to work with currencies in the code and describe each time "USD", "EUR"

Miniset allows you to create compact sets of fields that either combine into a string of classes, or return a simple array of values

Miniset allows you to create compact sets of fields that either combine into a string of classes, or return a simple array of values. Miniset

Fornece acesso de leitura ou gravação para o array através de notação de ponto

PHP Dot Notation Fornece acesso de leitura ou gravação para o array através de notação de ponto Lendo valores: Permite que você use uma sintaxe separa

A Blade directive to export variables to JavaScript
A Blade directive to export variables to JavaScript

A Blade directive to export variables to JavaScript This package contains a Blade directive to export values to JavaScript. Here's an example of how i

YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Lightweight and feature-rich PHP validation and filtering library. Support scene grouping, pre-filtering, array checking, custom validators, custom messages. 轻量且功能丰富的PHP验证、过滤库。支持场景分组,前置过滤,数组检查,自定义验证器,自定义消息。

PHP Validate 一个简洁小巧且功能完善的php验证、过滤库。 简单方便,支持添加自定义验证器 支持前置验证检查, 自定义如何判断非空 支持将规则按场景进行分组设置。或者部分验证 支持在进行验证前对值使用过滤器进行净化过滤内置过滤器 支持在进行验证前置处理和后置处理独立验证处理 支持自定义每

Keep your laravel logs small and tidy.

Logs can get quite out of hand. This package helps save server space and keep your Laravel log files small.

Pat if amp - ⚡ A Textpattern Conditional Plugin for Google's Accelerated Mobile Pages Project (AMP)
Pat if amp - ⚡ A Textpattern Conditional Plugin for Google's Accelerated Mobile Pages Project (AMP)

pat_if_amp Download | Packagist AMP pages for Textpattern CMS. This conditional tag examines the URL of the current page and determines if the URL end

PHPR or PHP Array Framework is a framework highly dependent to an array structure.

this is new repository for php-framework Introduction PHPR or PHP Array Framework is a framework highly dependent to an array structure. PHPR Framewor

Scripts-dev directive for composer

scriptsdev for Composer It's like require-dev, but for scripts Installation Just run composer require neronmoon/scriptsdev --dev Usage After installin

Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

TALL-stack form generator Laravel Livewire, Tailwind forms with auto-generated views. Support Contributions Features This is not an admin panel genera

Schedule your OLX searches and get notified by email when something new is published 📆
Schedule your OLX searches and get notified by email when something new is published 📆

Olx.ba search scheduler Missing scheduler for Olx.ba searches. Production-ready small web application which notifies you by email when something new i

UpDown is an uptime monitor, We send out notifications when something's wrong.

About UpDown Updown is an uptime monitor, We send out notifications when something's wrong. Be the first to know that your website is down! Reliable m

Magento 2 module to automatically flush the cache whenever you save something in the System Configuration

Yireo AutoFlushCache Magento 2 module to automatically flush the cache whenever you save something in the System Configuration. Do NOT use this in pro

QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific.

QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific. It is part of the QuidPHP package and can also be used standalone.

Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views
Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views

Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views. In all essence, it's a collection of useful utilities, connecting the dots between different parts of the TALL stack. It was made for Blade, Laravel's powerful templating engine.

Blade Snip allows you to use parts of a blade template multiple times. Basically partials, but inline.

Blade Snip Blade Snip allows you to use parts of a blade template multiple times. Basically partials, but inline: div class="products" @snip('pr

Releases(v0.1.0)
Owner
Ryan Chandler
Ryan Chandler
Pat if amp - ⚡ A Textpattern Conditional Plugin for Google's Accelerated Mobile Pages Project (AMP)

pat_if_amp Download | Packagist AMP pages for Textpattern CMS. This conditional tag examines the URL of the current page and determines if the URL end

Patrick LEFEVRE 4 Dec 15, 2019
Scripts-dev directive for composer

scriptsdev for Composer It's like require-dev, but for scripts Installation Just run composer require neronmoon/scriptsdev --dev Usage After installin

Vitaliy Krasnoperov 67 May 18, 2022
UpDown is an uptime monitor, We send out notifications when something's wrong.

About UpDown Updown is an uptime monitor, We send out notifications when something's wrong. Be the first to know that your website is down! Reliable m

Hussam Adil 4 May 8, 2022
Magento 2 module to automatically flush the cache whenever you save something in the System Configuration

Yireo AutoFlushCache Magento 2 module to automatically flush the cache whenever you save something in the System Configuration. Do NOT use this in pro

Yireo 21 May 14, 2022
QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific.

QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific. It is part of the QuidPHP package and can also be used standalone.

QuidPHP 4 Jul 2, 2022
SPAM Registration Stopper is a Q2A plugin that prevents highly probable SPAM user registrations based on well-known SPAM checking services and other techniques

SPAM Registration Stopper [by Gabriel Zanetti] Description SPAM Registration Stopper is a Question2Answer plugin that prevents highly probable SPAM us

Gabriel Zanetti 2 Jan 23, 2022
Nagios/Icinga plugin for checking SATEON field network device status

check_sateon Nagios/Icinga plugin for checking SATEON field network device status Max.Fischer [email protected] Tested on CentOS GNU/Linux 6.5 with Ici

null 1 May 27, 2022
Keep control over the complexity of your methods by checking that they do not have too many arguments.

php arguments detector The ideal number of arguments for a function is zero. ~ Robert C. Martin Keep control over the complexity of your methods by ch

DeGraciaMathieu 13 Dec 26, 2022
PHP bundle which makes array traversing / inserting dead easy.

XTraverse.php This bundle makes it dead easy to traverse through nested arrays/objects in PHP. Installation Via Composer composer require phiil/xtrave

Philipp Martini 2 Feb 12, 2022
Shortest Path - have a function ShortestPath (strArr) take strArr which will be an array of strings which models a non-looping Graph.

Have the function ShortestPath(strArr) take strArr which will be an array of strings which models a non-looping Graph

null 1 Feb 5, 2022