https://github.com/ergebnis/classy
🔍 Provides a composer package with a finder for classy constructs (classes, enums, interfaces, and traits).
https://github.com/ergebnis/classy
classes classy constructs enums finder interfaces traits
Last synced: 7 months ago
JSON representation
🔍 Provides a composer package with a finder for classy constructs (classes, enums, interfaces, and traits).
- Host: GitHub
- URL: https://github.com/ergebnis/classy
- Owner: ergebnis
- License: mit
- Created: 2017-09-29T09:28:29.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T15:05:00.000Z (about 1 year ago)
- Last Synced: 2024-10-23T18:58:30.932Z (about 1 year ago)
- Topics: classes, classy, constructs, enums, finder, interfaces, traits
- Language: PHP
- Homepage:
- Size: 3.7 MB
- Stars: 33
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# classy
[](https://github.com/ergebnis/classy/actions)
[](https://github.com/ergebnis/classy/actions)
[](https://github.com/ergebnis/classy/actions)
[](https://github.com/ergebnis/classy/actions)
[](https://codecov.io/gh/ergebnis/classy)
[](https://packagist.org/packages/ergebnis/classy)
[](https://packagist.org/packages/ergebnis/classy)
[](https://packagist.org/packages/ergebnis/classy)
This project provides a [`composer`](https://getcomposer.org) package with a finder for classy constructs ([classes](https://www.php.net/manual/en/language.oop5.php), [enums](https://www.php.net/manual/en/language.types.enumerations.php), [interfaces](https://www.php.net/manual/en/language.oop5.interfaces.php), and [traits](https://www.php.net/manual/en/language.oop5.traits.php)).
## Installation
Run
```sh
composer require ergebnis/classy
```
## Usage
### Collect classy constructs from source code
Use `Classy\Constructs::fromSource()` to collect classy constructs in source code:
```php
name();
}, $constructs);
var_dump($names); // ['Example\Bar', 'Example\Baz', 'Example\Foo', 'Example\Qux']
```
### Collect classy constructs from a directory
Use `Classy\Constructs::fromDirectory()` to collect classy constructs in a directory:
```php
name();
}, $constructs);
var_dump($names); // ['Example\Bar', 'Example\Bar\Baz', 'Example\Foo\Bar\Baz']
```
## Changelog
The maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md).
## Contributing
The maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md).
## Code of Conduct
The maintainers of this project ask contributors to follow the [code of conduct](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).
## General Support Policy
The maintainers of this project provide limited support.
You can support the maintenance of this project by [sponsoring @localheinz](https://github.com/sponsors/localheinz) or [requesting an invoice for services related to this project](mailto:am@localheinz.com?subject=ergebnis/classy:%20Requesting%20invoice%20for%20services).
## PHP Version Support Policy
This project supports PHP versions with [active and security support](https://www.php.net/supported-versions.php).
The maintainers of this project add support for a PHP version following its initial release and drop support for a PHP version when it has reached the end of security support.
## Security Policy
This project has a [security policy](.github/SECURITY.md).
## License
This project uses the [MIT license](LICENSE.md).
## Credits
The algorithm for finding classes in PHP files in [`Constructs`](src/Constructs.php) has been adopted from [`Zend\File\ClassFileLocator`](https://github.com/zendframework/zend-file/blob/release-2.7.1/src/ClassFileLocator.php) (originally licensed under BSD-3-Clause).
## Social
Follow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.