PHPackages                             chaseisabelle/phprom-bundle - 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. [API Development](/categories/api)
4. /
5. chaseisabelle/phprom-bundle

ActiveSymfony-bundle[API Development](/categories/api)

chaseisabelle/phprom-bundle
===========================

Symfony 4 PHProm Bundle

v0.0.6(5y ago)18731MITPHPPHP ^7.1

Since Oct 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chaseisabelle/phprom-bundle)[ Packagist](https://packagist.org/packages/chaseisabelle/phprom-bundle)[ RSS](/packages/chaseisabelle-phprom-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (5)Dependencies (8)Versions (8)Used By (0)

phprom client symfony 4+ bundle
===============================

[](#phprom-client-symfony-4-bundle)

a symfony client for [phprom](https://github.com/chaseisabelle/phprom), a prometheus metrics datastore for php apps

---

example
-------

[](#example)

see a fully functional example [here](https://github.com/chaseisabelle/phprom-example)

---

prerequisites
-------------

[](#prerequisites)

- [phprom](https://github.com/chaseisabelle/phprom) server
- [grpc extension](https://grpc.io/docs/languages/php/quickstart/)
    - `pecl install grpc`
    - or use the [docker image](https://hub.docker.com/r/grpc/php)

#### related

[](#related)

this is essentially a symfony bundle wrapper for the [phprom client](https://github.com/chaseisabelle/phprom-client)

---

install
-------

[](#install)

#### with symfony flex

[](#with-symfony-flex)

```
composer require chaseisabelle/phprom-bundle

```

#### without symfony flex

[](#without-symfony-flex)

1. install with composer ```
    composer require chaseisabelle/phprom-bundle

    ```
2. enable in `app/AppKernel.php````
    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(
                ...
                new ChaseIsabelle\PHPromBundle\ChaseIsabellePHPromBundle(),
            );
            ...
    ```

---

configure
---------

[](#configure)

1. create `config/packages/phprom.yaml`

    ```
    phprom:
      address: 127.0.0.1:3333 # optional, defaults to 127.0.0.1:3333
      api: grpc # optional, defaults to grpc (use "rest" for rest api)
      namespace: my_cool_app # required, the prefix for all your metrics
      routes: # optional, if empty or omitted then all routes will be recorded
        - my_cool_route # route can be plain string - only routes matching these strings will be recorded
        - /^.+$/ # route can be a regex - only routes matching this regex will be recorded
    ```
2. open `config/routes.yaml` and add

    ```
    metrics:
        resource: '@ChaseIsabellePHPromBundle/Resources/config/routes.xml'
    ```

    or you can customize

    ```
    metrics:
        path: /custom/url/path
        controller: ChaseIsabelle\PHPromBundle\Controller\MetricsController::metrics
    ```

---

custom metrics
--------------

[](#custom-metrics)

#### example

[](#example-1)

`src/Controller/DefaultController.php`

```
