Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Consul Api Bundle Laravel Package

dcarbone/php-consul-api-bundle

View on GitHub
Deep Wiki
Context7

php-consul-api-bundle

Bundle to enable usage of dcarbone/php-consul-api inside of a Symfony 3 project

Installation

In your composer.json file:

{
    "require": {
        "dcarbone/php-consul-api-bundle": "0.6.*"
    }
}

In your AppKernel.php file:

    public function registerBundles()
    {
        $bundles = [
            // --
            new \DCarbone\PHPConsulAPIBundle\PHPConsulAPIBundle(),
            // --
        ];

        // --

        return $bundles;
    }

Local Configuration

There will always be at least one registered Consul service using the standard Consul environment variables. If you wish to use this, at the very least CONSUL_HTTP_ADDR should be defined.

The service can be accessed using the consul_api.local service. This is also the default target of the consul_api.default alias.

Default Configuration

You may optionally override the default configuration with one of the named configurations you have specified as such:

consul_api:
    default_configuration: nifty_name

Named Configurations

If you wish to connect to multiple Consul agents, or just want to have things named differently, you may optionally configure them under the consul_api configuration namespace.

The available configuration parameters are:

  • addr
  • scheme
  • datacenter
  • wait_time
  • http_auth
  • token
  • ca_file
  • client_cert
  • client_key
  • insecure_skip_verify
  • token_in_header
  • http_client

As an example:

consul_api:
    named_configurations:
        nifty_name:
            addr:                   hostname.domain.woot
            scheme:                 https
            insecure_skip_verify:   false
            http_client:            ~ # Enter service name of GuzzleHttp\ClientInterface compatible http client you wish to use

This will create a new service named consul_api.nifty_name with the specified configuration options.

Twig Integration

If you are using Twig and TwigBundle in your Symfony app, there are a few functions exposed to you. You can see the full list here: PHPConsulAPIExtension.

ConsulBag

If you have multiple named configurations present and want to be able to access them all, one possible way is to utilize the ConsulBag service. It is defined as consul_api.bag

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin