All Projects → theofidry → Laravelyaml

theofidry / Laravelyaml

Licence: mit
Laravel ServiceProvider for using YAML configuration files

Projects that are alternatives of or similar to Laravelyaml

zf-dependency-injection
Advanced dependency injection for laminas framework
Stars: ✭ 17 (+112.5%)
Mutual labels:  yaml, dependency-injection
ufw
A minimalist framework for rapid server side applications prototyping in C++ with dependency injection support.
Stars: ✭ 19 (+137.5%)
Mutual labels:  yaml, dependency-injection
Quicklib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Config, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Stars: ✭ 274 (+3325%)
Mutual labels:  yaml, dependency-injection
Di
Dependency Injection and IoC framework for PHP
Stars: ✭ 5 (-37.5%)
Mutual labels:  dependency-injection
Inject.dart
Compile-time dependency injection for Dart and Flutter
Stars: ✭ 833 (+10312.5%)
Mutual labels:  dependency-injection
Doramon
常见工具汇总:一键式生成整个前后端工具,单机高性能幂等工具,zookeeper客户端工具,分布式全局id生成器,一致性哈希工具,Bitmap工具,布隆过滤器参数生成器,Yaml和properties互转工具等等
Stars: ✭ 24 (+200%)
Mutual labels:  yaml
Lld Parking Lot
Repository for low level design solution of parking lot
Stars: ✭ 27 (+237.5%)
Mutual labels:  dependency-injection
Ruby Advisory Db
A database of vulnerable Ruby Gems
Stars: ✭ 821 (+10162.5%)
Mutual labels:  yaml
Kodein Mvvm
Example app using Kodein for dependency injection with MVVM and Architecture Components
Stars: ✭ 26 (+225%)
Mutual labels:  dependency-injection
Parameterhandler
Composer script handling your ignored parameter file
Stars: ✭ 906 (+11225%)
Mutual labels:  yaml
Hugo Elasticsearch
Generate Elasticsearch indexes for Hugo static sites by parsing front matter
Stars: ✭ 19 (+137.5%)
Mutual labels:  yaml
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+10350%)
Mutual labels:  yaml
Home Assistant Config
Home Assistant config files, rewritten to use the latest features, 100+ documented automations, automatically generated ToC 🏠 🤖
Stars: ✭ 926 (+11475%)
Mutual labels:  yaml
Marvelheroes
❤️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin) architecture.
Stars: ✭ 826 (+10225%)
Mutual labels:  dependency-injection
Swiftresolver
Dependency injection framework for Swift
Stars: ✭ 26 (+225%)
Mutual labels:  dependency-injection
Koin
Koin - a pragmatic lightweight dependency injection framework for Kotlin
Stars: ✭ 7,142 (+89175%)
Mutual labels:  dependency-injection
Fastmatter
👀 A fast frontmatter parser. Supports both string and stream inputs.
Stars: ✭ 25 (+212.5%)
Mutual labels:  yaml
Raccoon Plugin
With Raccoon, use a JSON or YAML file to manage WordPress theme features
Stars: ✭ 18 (+125%)
Mutual labels:  yaml
Grpc
A proof of concept for a way to implement gRPC services in a code first way using C# and .NET Core.
Stars: ✭ 17 (+112.5%)
Mutual labels:  dependency-injection
Koa Typeorm Starter
Starter project for using koa with TS and TypeORM
Stars: ✭ 23 (+187.5%)
Mutual labels:  dependency-injection

Laravel Yaml ServiceProvider

Package version Build Status SensioLabsInsight Dependency Status Scrutinizer Code Quality Code Coverage License

A simple Laravel library to declare your parmeters and services in Yaml like in Symfony:

# resources/providers/services.yml

services:
    dummy_service:
        class: App\Services\DummyService
        alias: dummy
        arguments:
            - %app.url%
            - %app.env%

instead of:

# app/Providers/AppServiceProvider.php

//...
public function register()
{
    $this->app->singleton(
        'dummy_service',
        function ($app) {
            $url = env('APP_URL');
            $env = env('APP_ENV');

            return new \App\Services\DummyService($url, $env);
        }
    );
}

Documentation

  1. Disclaimer: why using this library?
  2. Install
  3. Everything about parameters
  4. YAML vs PHP
  5. Refering to another value
  6. Refering to an environment value
  7. Refering to constants
  8. Overriding values
  9. Environment dependent parameters
  10. Service declaration
  11. Simple services
  12. Factories
  13. Decorating services
  14. Custom file organisation
  15. Import other files
  16. Use your own provider

Install

You can use Composer to install the bundle to your project:

composer require theofidry/laravel-yaml

Then, add the provider Fidry\LaravelYaml\Provider\DefaultExtensionProvider to your application providers:

<?php
// config/app.php

'providers' => [
    // ...
    \Fidry\LaravelYaml\Provider\DefaultExtensionProvider::class,
];

Usage

See how to declare and use parameters and services!

By convention, you should have the following structure:

resources/
    providers/
        parameters.yml
        parameters_testing.yml
        services.yml

The parameters.yml should contain all of your application parameters values:

# resources/providers/parameters.yml

parameters:
    my_parameter: parameter_value

Depending of your environment, a second parameters file will be loaded. For example, if your application environment (by default defined by the environment variable APP_ENV in your .env file) is 'testing' or 'production', the library will try to load the parameters_testing.yml or parameters_production.yml file.

Then services.yml should contain all your service definitions.

See more.

Credits

This bundle is developed by Théo FIDRY.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].