Download the PHP package ibrostudio/laravel-neon-config without Composer

On this page you can find all versions of the php package ibrostudio/laravel-neon-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-neon-config

Laravel Neon Config

Latest Version on Packagist

Introduction

Laravel Neon Config is a package that integrates Neon configuration files with Laravel's config system. Neon is a human-friendly data serialization language similar to YAML but with a focus on being more readable and concise.

What is Neon?

Neon (Nette Object Notation) is a human-readable structured data format. It is similar to YAML but is more focused on being concise and readable. Neon is developed by the Nette Foundation and is used extensively in Nette Framework applications.

Goal of this Package

The primary goal of this package is to provide a configuration mechanism that works outside the context of a Laravel application. This is particularly useful in scenarios such as:

This package allows you to use a .neon file to overwrite a Laravel config file.

Installation

You can install the package via composer:

Basic Usage

In a Package Service Provider

Add the trait UseNeonConfig to your package service provider and define your "neon to config" mapping:

With Spatie's Package Skeleton

If your package uses PackageServiceProvider from Spatie's package-skeleton-laravel and you are only dealing with a single config file, you can omit the name parameters:

How It Works

When a user of your package creates a .neon file at the root of their project with the same name as your package, the values from that file will be merged with your package's configuration.

For example, if your package has this configuration:

The user can create a file named your-package.neon at the root of their project:

Values are merged by keys, which means:

Advanced Features

Casting and Dynamic Values

Enums

If your config uses PHP Enums, you can cast values from the Neon file to the appropriate enum type:

At the root of your package, create a file named neon-config.neon:

Then, the user can override the enum value in their Neon file:

Now, calling config('your-package.key1') will return an instance of \Namespace\SomeEnumClass::NEW_VALUE.

Array of Enums

You can also cast arrays of values to arrays of enum instances:

In your neon-config.neon:

And in the user's Neon file:

Dynamic Values from Config or Environment

You can also reference other config values or environment variables:

In your neon-config.neon:

And in the user's Neon file:

Using as an Environment File for Tests

When developing a package, you can use Neon files as environment files for your tests:

Configuration

Add the trait to your TestCase instead of the package service provider:

Create a test.neon file at the root of your package (add it to .gitignore):

During tests, you can now access these values with config('test.key1').

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-neon-config with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^10.0||^11.0||^12.0
nette/neon Version ^3.4
spatie/laravel-data Version ^4.9
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ibrostudio/laravel-neon-config contains the following files

Loading the files please wait ....