{"id":21874541,"url":"https://github.com/smoren/bitmap-tools-php","last_synced_at":"2025-06-19T22:34:22.074Z","repository":{"id":57750582,"uuid":"525830869","full_name":"Smoren/bitmap-tools-php","owner":"Smoren","description":"Tools for working with bitmaps","archived":false,"fork":false,"pushed_at":"2022-08-22T09:56:01.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-25T14:08:45.342Z","etag":null,"topics":["bitmap","helper","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Smoren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-17T14:33:23.000Z","updated_at":"2024-12-18T21:10:35.000Z","dependencies_parsed_at":"2022-08-26T08:31:36.920Z","dependency_job_id":null,"html_url":"https://github.com/Smoren/bitmap-tools-php","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Smoren/bitmap-tools-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fbitmap-tools-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fbitmap-tools-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fbitmap-tools-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fbitmap-tools-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Smoren","download_url":"https://codeload.github.com/Smoren/bitmap-tools-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fbitmap-tools-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260843756,"owners_count":23071622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitmap","helper","php"],"created_at":"2024-11-28T07:12:40.414Z","updated_at":"2025-06-19T22:34:17.043Z","avatar_url":"https://github.com/Smoren.png","language":"PHP","readme":"# bitmap-tools\n\n![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/smoren/bitmap-tools)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Smoren/bitmap-tools-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Smoren/bitmap-tools-php/?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/Smoren/bitmap-tools-php/badge.svg?branch=master)](https://coveralls.io/github/Smoren/bitmap-tools-php?branch=master)\n![Build and test](https://github.com/Smoren/bitmap-tools-php/actions/workflows/test_master.yml/badge.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nTools for working with bitmaps\n\n### How to install to your project\n```\ncomposer require smoren/bitmap-tools\n```\n\n### Unit testing\n```\ncomposer install\ncomposer test-init\ncomposer test\n```\n\n### Usage\n\n#### Simple usage\n\n```php\nuse Smoren\\BitmapTools\\Models\\Bitmap;\n\n// Create bitmap by int value:\n$bm = Bitmap::create(6); // bitmap: 110\n\n// Create bitmap by true bit positions:\n$bm = Bitmap::create([1, 2]); // bitmap: 110\n\n// Basic operations:\n$bm = Bitmap::create([0, 2]);\nvar_dump($bm-\u003egetValue()); // 5\nvar_dump($bm-\u003etoArray()); // [0, 2]\nvar_dump($bm-\u003ehasBit(0)); // true\nvar_dump($bm-\u003ehasBit(1)); // false\nvar_dump($bm-\u003ehasBit(2)); // true\n\n$bm = Bitmap::create([0, 1, 2]);\nvar_dump($bm-\u003egetValue()); // 7\nvar_dump($bm-\u003etoArray()); // [0, 1, 2]\n\n$bm = Bitmap::create([]);\nvar_dump($bm-\u003egetValue()); // 0\nvar_dump($bm-\u003etoArray()); // []\n\n// Intersections:\n$bm = Bitmap::create(7);\nvar_dump($bm-\u003eintersectsWith(Bitmap::create(1))); // true\nvar_dump($bm-\u003eintersectsWith(Bitmap::create([1, 2]))); // true\n\n$bm = Bitmap::create(6);\nvar_dump($bm-\u003eintersectsWith(Bitmap::create(2))); // true\nvar_dump($bm-\u003eintersectsWith(Bitmap::create(0))); // false\n\n// Inclusions:\n$bm = Bitmap::create(6);\nvar_dump($bm-\u003eincludes(Bitmap::create(2))); // true (in binary numbers: 110 includes 010)\nvar_dump($bm-\u003eincludes(Bitmap::create(1))); // false (in binary numbers: 110 not includes 001)\nvar_dump($bm-\u003eincludes(Bitmap::create(3))); // false (in binary numbers: 110 not includes 011)\n\n// Additions:\n$bm = Bitmap::create(2); // bitmap: 010\n$bm = $bm-\u003eadd(Bitmap::create(1)); // bitmap: 011\n$bm = $bm-\u003eadd(Bitmap::create(6)); // bitmap: 111\n\n// Subtractions:\n$bm = Bitmap::create(15); // bitmap: 1111\n$bm = $bm-\u003esub(Bitmap::create(6)); // bitmap: 1001\n$bm = $bm-\u003esub(Bitmap::create(3)); // bitmap: 1000\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoren%2Fbitmap-tools-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoren%2Fbitmap-tools-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoren%2Fbitmap-tools-php/lists"}