Download the PHP package vinicciusguedes/laravel-bitwise without Composer
On this page you can find all versions of the php package vinicciusguedes/laravel-bitwise. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vinicciusguedes/laravel-bitwise
More information about vinicciusguedes/laravel-bitwise
Files in vinicciusguedes/laravel-bitwise
Package laravel-bitwise
Short Description Pacote para facilitar a manipulação de números usando operações bitwise no Laravel.
License MIT
Homepage https://github.com/vinicciusguedes/laravel-bitwise
Informations about the package laravel-bitwise
Laravel Bitwise
Pacote para facilitar a manipulação de números usando operações bitwise no Laravel. Ideal para casos de uso como gerenciamento de permissões e flags, fornecendo funções para verificar, ativar, desativar e inverter bits de forma simples e eficiente.
Instalação
Instalar via Composer
Você pode instalar o pacote através do Composer:
Compatibilidade: Laravel e PHP
Esta tabela mostra as versões do Laravel e suas versões compatíveis com o PHP.
Laravel | PHP |
---|---|
11.* | 8.4, 8.3, 8.2, 8.1, 8.0 |
10.* | 8.4, 8.3, 8.2, 8.1, 8.0 |
9.* | 8.4, 8.3, 8.2, 8.1, 8.0 |
8.* | 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3 |
7.* | 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2 |
6.* | 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2 |
A tabela de compatibilidade pode ser ajustada de acordo com novas atualizações de versões do PHP ou Laravel.
Funcionalidades
O pacote oferece funções úteis para trabalhar com operações bitwise, como:
- Adiciona um bit a um valor atual
- Remove um bit de um valor
- Verifica se um bit está ativo
- Obtém todos os bits ativos de um valor
- Manipula bits em arrays
Funções Disponíveis
✅ addBit(int $currentValue, int $bit): int
- Adiciona um bit ao valor atual usando a operação OR (|).
- Adds a specific bit to the current value using the OR (|) operation.
✅ addBits(int $currentValue, int $bit): int
- Adiciona todos os bits fornecidos no valor atual usando operação OR (|).
- Adds all provided bits in the current value using the OR (|) operation.
✅ removeBit(int $currentValue, int $bit): int
- Remove um bit específico do valor atual usando operação AND NOT (& ~).
- Removes a specific bit from the current value using the AND NOT (& ~) operation.
✅ removeBits(int $currentValue, array $bits): int
- Remove todos os bits fornecidos no valor atual usando operação AND NOT (& ~).
- Removes all provided bits in the current value using the AND NOT (& ~) operation.
✅ hasBit(int $currentValue, int $bit): bool
- Verifica se um bit específico está ativo no valor atual usando a operação AND (&).
- Checks if a specific bit is active in the current value using the AND (&) operation.
✅ hasAllBits(int $bitValue, array $bits): bool
- Verifica se todos os bits fornecidos estão ativos no valor.
- Checks if all the provided bits are active in the value.
✅ getActiveBits(int $value, bool $key_type = true, bool $order = true): array
- Retorna todos os bits ativos no valor fornecido.
- Returns an array of all active bits in the value.
✅ sumActiveBits(array $bits): int
- Retorna o valor total da soma dos bits ativos.
- Returns the total value of the sum of the active bits.
✅ addBitInArray(array $array, int $bit, bool $key_type = true, bool $order = true): array
- Adiciona um bit a um array, garantindo que o valor seja único.
- Adds a bit to an array, ensuring it is not duplicated.
✅ hasBitsInArray(int $bitValue, array $bits): array
- Verifica se cada valor de um array está presente nos bits de um valor dado.
- Checks if each value in an array is present in the bits of a given value.
✅ sortBitsByKey(array $bits): array
- Ordena as chaves do array com base nas chaves.
- Sorts the keys of the array based on the keys.
✅ sortBitsByValue(array $bits): array
- Ordena array com base nos valores.
- Sorts the array based on the values.
✅ toBinaryString(int $value): string
- Converte um valor inteiro para uma string binária.
- Converts an integer value to a binary string.
✅ fromBinary(string $value): int
- Converte um valor binário de volta para inteiro.
- Convert a binary value back to integer.
✅ function invertBit(int $value): int
- Inverte bit do valor.
- Invert the value bit.
Desenvolvedor: Viníccius Guedes