{"id":15167158,"url":"https://github.com/nette/reflection","last_synced_at":"2025-10-01T00:31:02.907Z","repository":{"id":14969124,"uuid":"17694049","full_name":"nette/reflection","owner":"nette","description":"[DISCONTINUED] Docblock annotations parser and common reflection classes","archived":true,"fork":false,"pushed_at":"2019-02-20T20:40:33.000Z","size":203,"stargazers_count":90,"open_issues_count":0,"forks_count":27,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-12-16T16:03:04.438Z","etag":null,"topics":["annotations","doc-comments","nette","nette-framework","php","phpdoc","reflection"],"latest_commit_sha":null,"homepage":"https://nette.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nette.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-13T03:46:53.000Z","updated_at":"2024-12-16T08:22:02.000Z","dependencies_parsed_at":"2022-08-27T20:02:21.615Z","dependency_job_id":null,"html_url":"https://github.com/nette/reflection","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/nette%2Freflection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Freflection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Freflection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Freflection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nette","download_url":"https://codeload.github.com/nette/reflection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234796856,"owners_count":18888156,"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":["annotations","doc-comments","nette","nette-framework","php","phpdoc","reflection"],"created_at":"2024-09-27T05:40:44.208Z","updated_at":"2025-10-01T00:31:02.622Z","avatar_url":"https://github.com/nette.png","language":"PHP","readme":"Nette PHP Reflection\n====================\n\n[![Downloads this Month](https://img.shields.io/packagist/dm/nette/reflection.svg)](https://packagist.org/packages/nette/reflection)\n[![Build Status](https://travis-ci.org/nette/reflection.svg?branch=master)](https://travis-ci.org/nette/reflection)\n[![Coverage Status](https://coveralls.io/repos/github/nette/reflection/badge.svg?branch=master)](https://coveralls.io/github/nette/reflection?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/nette/reflection/v/stable)](https://github.com/nette/reflection/releases)\n[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/reflection/blob/master/license.md)\n\nInstall it using Composer:\n\n```\ncomposer require nette/reflection\n```\n\nThe last stable release requires PHP version 5.6 or newer (is compatible with PHP 7.0 and 7.1).\n\nIf you like Nette, **[please make a donation now](https://nette.org/donate)**. Thank you!\n\nIf you need to find every information about any class, reflection is the right tool to do it. You can easily find out which methods does any class have, what parameters do those methods accept, etc.\n\n```php\n// getting PDO class reflection\n$classReflection = new Nette\\Reflection\\ClassType('PDO');\n\n// getting PDO::query method reflection\n$methodReflection = new Nette\\Reflection\\Method('PDO', 'query');\n```\n\nAnnotations\n-----------\n\nReflection has really a lot to do with annotations. The annotations are written into phpDoc comments (two opening asterisks are mandatory!) and start with `@`. You can annotate classes, variables and methods:\n\n```php\n/**\n * @author John Doe\n * @author Tomas Marny\n * @secured\n */\nclass FooClass\n{\n\t/** @Persistent */\n\tpublic $foo;\n\n\t/** @User(loggedIn, role=Admin) */\n\tpublic function bar() {}\n}\n```\n\nIn the code there are these annotations:\n\n- `@author John Doe` - string, contains text value `'John Doe'`\n- `@Persistent` - boolean, its presence means `true`\n- `@User(loggedIn, role=Admin)` - contains associative `array('loggedIn', 'role' =\u003e 'Admin')`\n\n\nThe existence of a class annotation can be checked via `hasAnnotation()` method:\n\n\n```php\n$fooReflection = new Nette\\Reflection\\ClassType('FooClass');\n$fooReflection-\u003ehasAnnotation('author'); // returns true\n$fooReflection-\u003ehasAnnotation('copyright'); // returns false\n```\n\nValues can be acquired with `getAnnotation()`:\n\n```php\n$fooReflection-\u003egetAnnotation('author'); // returns string 'Tomas Marny'\n\n$fooReflection-\u003egetMethod('bar')-\u003egetAnnotation('User');\n// returns array('loggedIn', 'role' =\u003e 'Admin')\n```\n\n.[caution]\nPrevious definitions are overwritten with the latter ones, sou you will always get the last one.\n\nAll annotations can be obtained with `getAnnotations()`:\n\n```\narray(3) {\n\t\"author\" =\u003e array(2) {\n\t\t0 =\u003e string(8) \"John Doe\"\n\t\t1 =\u003e string(11) \"Tomas Marny\"\n\t}\n\t\"secured\" =\u003e array(1) {\n\t\t0 =\u003e bool(true)\n\t}\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnette%2Freflection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnette%2Freflection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnette%2Freflection/lists"}