Skip to content

Aliance/Bitmask

Repository files navigation

Simple bitmask implementation

License Packagist PHP Version Code Coverage

About

Bitmask is a simple PHP implementation of bitwise operations for creating masks. Can be used for some flags' implementation. Supports only 64 bits (from 0 to 63) on x64 platforms.

Installation

Install the latest version with composer:

composer require aliance/bitmask

If you checkout this library for testing purposes, install its dependencies:

docker run --rm -it --volume $PWD:/app -u $(id -u):$(id -g) composer:2 i

Usage

See usage in sample file.

docker run -it --rm -v "$PWD":/usr/src/bitmask -w /usr/src/bitmask php:8.1-cli php example/example.php  
Check user for all access levels:
Create: no
Read: no
Update: no
Delete: no
–––––––––––––––––––––––––––––––––––

Check user for all access levels:
Create: no
Read: yes
Update: no
Delete: no
–––––––––––––––––––––––––––––––––––

Tests

For completely tests running just call composer exec phpunit or use

docker run -it --rm -v "$PWD":/usr/src/bitmask -w /usr/src/bitmask php:8.1-cli php ./vendor/bin/phpunit 

License

This software is distributed under MIT license.