Download the PHP package oscarnevarezleal/laravel-sed without Composer
On this page you can find all versions of the php package oscarnevarezleal/laravel-sed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oscarnevarezleal/laravel-sed
More information about oscarnevarezleal/laravel-sed
Files in oscarnevarezleal/laravel-sed
Informations about the package laravel-sed
Laravel SED
A CLI utility that modifies Laravel configuration files.
Note: This project is primarily intended as CLI tool to manage laravel applications from the outside, although it contains several laravel commands expect that the majority of features will be unavailable as Laravel commands.
Installation
Usage
Commands
Command | Description | Arguments |
---|---|---|
larased:config-edit | Replace configuration value | $config-path $value [options] |
Options
Short version | Long version | Comments |
---|---|---|
-d | --basePath | The working directory |
-e | --envor | When this option is specified, the substitution will have a call to the env function using as 1st argument the value taken from the environment key specified and secondly a literal value or another env call when using chained envs (See Environment chain in the examples section ) |
Concepts
Before dive in into the examples, a previous step is to clarify what a config path is so you know how to use it when editing Laravel configuration files.
Config Paths
Most of the commands expect a valid
config-path
to work with.Config paths consists of two parts joined by a slash.
The first part is the relative path of the file to be modified seen from the root of the project and, without especial characters nor file extensions.
The second part is the array property path found in the file.
Example
A property name in
./config/app.php
became the config pathconfig.app/name
A nested property such as the user in a mysql connection configured in
./config/database.php
became theconfig.database/connections.mysql.user
Examples
Literal values
Take the following part of the configuration file config/app.php
for instance.
If you'd like to change a literal value, e.g., name to MyAwesomeApp you run the following command:
It will result in:
What about environment values check with a default value? In that case we need to use the -e
flag like this:
It will result in:
Nested properties
Some other properties are not very at hand but nested under an array path. Take the username of a mysql connection for instance.
It will result on a successful update as shown below.
Environment chain with default
Sometimes there's no one but multiple environment variables you'd like to use before the default. In that case the flag -e
has a convenient variant that we can use. A list of environment variables names can be separated by a pipe |
.
Docker
Known Drawbacks
How to Apply Coding Standards?
This package uses nikic/php-parser, built on technology called an abstract syntax tree (AST). An AST doesn't know about spaces and when written to a file it produces poorly formatted code in both PHP and docblock annotations. That's why your project needs to have a coding standard tool such as ECS.