Download the PHP package cmandersen/bitwise without Composer

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

Laravel Bitwise Package

A Laravel package that makes it easy to work with bitwise flags in Eloquent models. Store multiple boolean flags efficiently in a single integer database column with natural query syntax.

Requirements

Installation

Install the package via Composer:

The package will automatically register itself via Laravel's package discovery.

Setup Your Database

Create your database column as an unsigned integer:

Cast Your Model Attributes

Add bitwise casting to your Eloquent model attributes:

Working with Flags

Once cast, your attribute becomes a BitwiseCollection with many helpful methods:

Querying Models by Flags

The package automatically adds powerful query methods to all your models. No traits or additional setup required!

Basic Queries

Combining with Other Conditions

Complete Query Reference

All methods support OR variations (prefix with or):

Array-like Access

BitwiseCollection implements ArrayAccess, so you can use array syntax:

Setting Flags During Creation/Update

You can set flags in several ways:

Advanced Usage

For more advanced use cases, you can work with individual flags and utilities:

Manual Flag Generation

Working with Individual Flags

Methods Reference

BitwiseCollection Methods

Method Description Returns
has(...$flags) Check if all specified flags are set bool
hasAny(...$flags) Check if any specified flags are set bool
add(...$flags) Add flags (returns new instance) BitwiseCollection
remove(...$flags) Remove flags (returns new instance) BitwiseCollection
toggle(...$flags) Toggle flags (returns new instance) BitwiseCollection
only(...$flags) Keep only specified flags BitwiseCollection
except(...$flags) Remove specified flags (alias for remove) BitwiseCollection
clear() Remove all flags BitwiseCollection
all() Set all available flags BitwiseCollection
getValue() Get integer value int
getFlags() Get array of BitwiseFlag objects array
getFlagNames() Get array of active flag names array
isEmpty() Check if no flags are set bool
isNotEmpty() Check if any flags are set bool
toArray() Get array of active flag names array
count() Count active flags int

BitwiseFlag Methods

Method Description Returns
is($flag) Check if this flag matches another bool
hasValue($value) Check if flag has specific value bool
isPowerOfTwo() Check if value is power of 2 bool
combine(...$flags) Combine with other flags int
isSetIn($value) Check if flag is set in value bool
setBit($value) Set this flag in value int
unsetBit($value) Unset this flag in value int
toggleBit($value) Toggle this flag in value int

License

This package is open-sourced software licensed under the MIT license.


All versions of bitwise with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/contracts Version ^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^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 cmandersen/bitwise contains the following files

Loading the files please wait ...