PHPackages                             ta-tikoma/bog-jug - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ta-tikoma/bog-jug

ActiveLibrary

ta-tikoma/bog-jug
=================

Convert regex group to objects

13.0k↓50%PHP

Since Aug 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ta-tikoma/bog-jug)[ Packagist](https://packagist.org/packages/ta-tikoma/bog-jug)[ RSS](/packages/ta-tikoma-bog-jug/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Bog Jug
=======

[](#bog-jug)

A tool that makes it easier to work with regex groups. Mapped regex group to php-classes, because array is sucks.

[![Static Badge](https://camo.githubusercontent.com/c6115e0ea88861e77160b3b03e3ee41100b8def40c5db393d9cdbea51cfa1f95/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d627269676874677265656e)](https://camo.githubusercontent.com/c6115e0ea88861e77160b3b03e3ee41100b8def40c5db393d9cdbea51cfa1f95/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d627269676874677265656e)[![Static Badge](https://camo.githubusercontent.com/b75696a4c92afc70b9911ae7fc1ba07eaac90e0089a4069d4578299ee6f68cb9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c5f382d627269676874677265656e)](https://camo.githubusercontent.com/b75696a4c92afc70b9911ae7fc1ba07eaac90e0089a4069d4578299ee6f68cb9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c5f382d627269676874677265656e)[![Static Badge](https://camo.githubusercontent.com/e23d01e0512f5a766b8dbf0d1caaaa5020ec8b4f5a54508c3ba26c651ecd6165/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50485043532d50535231322d627269676874677265656e)](https://camo.githubusercontent.com/e23d01e0512f5a766b8dbf0d1caaaa5020ec8b4f5a54508c3ba26c651ecd6165/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50485043532d50535231322d627269676874677265656e)[![GitHub](https://camo.githubusercontent.com/a1da522375668381389beb617041c097c405615469f300e46604e5df69b30cea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74612d74696b6f6d612f626f672d6a7567)](https://camo.githubusercontent.com/a1da522375668381389beb617041c097c405615469f300e46604e5df69b30cea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74612d74696b6f6d612f626f672d6a7567)

[Install](https://packagist.org/packages/ta-tikoma/bog-jug)
===========================================================

[](#install)

`composer require ta-tikoma/bog-jug`

Use
===

[](#use)

- Create a class for regex descriptions.
- Use property attributes for defined regex group: `#[Group('...')]` for group body; `#[After]` and `#[Before]` for defined outside symbols.
- If you need to indicate the count of a group, use attributes like `#[ZeroOrOne]`, `#[ZeroOrMore]` and others from the namespace `BogJug\Attributes\Count`.
- Finally, you can add regex flags via the class attributes; for example: `#[SingleLine]`.
- Now create instance of class BogJug and use one of two base methods:
    - Method `->one($regex, $text)` to find the first value equal to regex; analogue: `preg_match`.
    - Method `->many($regex, $text)` to get all values equal regex; analog: `preg_match_all`.

Sample example
==============

[](#sample-example)

#### 1. Define class of descriptions.

[](#1-define-class-of-descriptions)

```
