{"id":16568723,"url":"https://github.com/drupol/anonymize","last_synced_at":"2025-08-01T11:38:50.150Z","repository":{"id":56972687,"uuid":"104116278","full_name":"drupol/anonymize","owner":"drupol","description":"Converts an object/class into an anonymous class.","archived":false,"fork":false,"pushed_at":"2019-08-14T21:28:45.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-16T00:42:07.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/drupol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"drupol"}},"created_at":"2017-09-19T19:03:21.000Z","updated_at":"2022-09-16T04:03:00.000Z","dependencies_parsed_at":"2022-08-21T07:10:29.302Z","dependency_job_id":null,"html_url":"https://github.com/drupol/anonymize","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fanonymize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fanonymize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fanonymize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fanonymize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drupol","download_url":"https://codeload.github.com/drupol/anonymize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242022883,"owners_count":20059295,"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":[],"created_at":"2024-10-11T21:11:30.880Z","updated_at":"2025-03-05T11:42:31.542Z","avatar_url":"https://github.com/drupol.png","language":"PHP","funding_links":["https://github.com/sponsors/drupol","https://paypal.me/drupol"],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://img.shields.io/packagist/v/drupol/anonymize.svg?style=flat-square)](https://packagist.org/packages/drupol/anonymize)\n [![GitHub stars](https://img.shields.io/github/stars/drupol/anonymize.svg?style=flat-square)](https://packagist.org/packages/drupol/anonymize)\n [![Total Downloads](https://img.shields.io/packagist/dt/drupol/anonymize.svg?style=flat-square)](https://packagist.org/packages/drupol/anonymize)\n [![Build Status](https://img.shields.io/travis/drupol/anonymize/master.svg?style=flat-square)](https://travis-ci.org/drupol/anonymize)\n [![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/drupol/anonymize/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/anonymize/?branch=master)\n [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/drupol/anonymize/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/anonymize/?branch=master)\n [![Mutation testing badge](https://badge.stryker-mutator.io/github.com/drupol/anonymize/master)](https://stryker-mutator.github.io)\n [![License](https://img.shields.io/packagist/l/drupol/anonymize.svg?style=flat-square)](https://packagist.org/packages/drupol/anonymize)\n [![Say Thanks!](https://img.shields.io/badge/Say-thanks-brightgreen.svg?style=flat-square)](https://saythanks.io/to/drupol)\n [![Donate!](https://img.shields.io/badge/Donate-Paypal-brightgreen.svg?style=flat-square)](https://paypal.me/drupol)\n \n# Anonymize\n\n## Description\n\nConvert a regular class into an anonymous class.\n\n## Features\n\n* Converts public properties and methods into dynamic classes and properties.\n\n## Requirements\n\n* PHP \u003e= 7.1.3\n\n## Installation\n\n`composer require drupol/anonymize`\n\n## Usage\n\nUsing the object:\n\n```php\n\u003c?php\n\ninclude 'vendor/autoload.php';\n\nclass Hello\n{\n    public $property = 'YES!';\n\n    public function say()\n    {\n        echo 'Hello ' . $this-\u003eworld();\n    }\n\n    private function world()\n    {\n        return 'world!';\n    }\n}\n\n$class = new Hello();\n$class-\u003esay(); // Hello world!\n\n$anonymizedClass = \\drupol\\Anonymize\\Anonymize::convertToAnonymous($class);\n\n$anonymizedClass::addDynamicMethod('say', function () use ($anonymizedClass) {\n    echo 'Goodbye ' . $anonymizedClass-\u003eworld();\n});\n\n$anonymizedClass::addDynamicMethod('world', function () {\n    return 'universe!';\n});\n\n$anonymizedClass-\u003esay(); // Goodbye universe!\n```\n\n## API\n\n```php\n\u003c?php\n\n/**\n * Convert an object into an anonymous object.\n *\n * @param \\stdClass $object\n *   The object to convert.  \n *\n * @return Anonymize\n */\nAnonymizeTrait::convertToAnonymous($object);\n\n```\n\nThe rest of the library API relies and inherit from [DynamicObjects](https://github.com/drupol/dynamicobjects).\n\n## Code quality, tests and benchmarks\n\nEvery time changes are introduced into the library, [Travis CI](https://travis-ci.org/drupol/phptree/builds) run the tests and the benchmarks.\n\nThe library has tests written with [PHPSpec](http://www.phpspec.net/).\nFeel free to check them out in the `spec` directory. Run `composer phpspec` to trigger the tests.\n\nBefore each commit some inspections are executed with [GrumPHP](https://github.com/phpro/grumphp), run `./vendor/bin/grumphp run` to check manually.\n\n[PHPInfection](https://github.com/infection/infection) is used to ensure that your code is properly tested, run `composer infection` to test your code.\n\n## Contributing\n\nFeel free to contribute to this library by sending Github pull requests. I'm quite reactive :-)\n\n## Sponsors\n\n* [ARhS Development](https://www.arhs-group.com)\n* [European Commission - DIGIT](https://github.com/ec-europa)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrupol%2Fanonymize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrupol%2Fanonymize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrupol%2Fanonymize/lists"}