PHPackages                             surgiie/blade-cli - 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. [CLI &amp; Console](/categories/cli)
4. /
5. surgiie/blade-cli

Abandoned → [surgiie/laravel-blade-cli](/?search=surgiie%2Flaravel-blade-cli)ArchivedProject[CLI &amp; Console](/categories/cli)

surgiie/blade-cli
=================

Use Laravel's blade engine from the command line to render files.

v4.1.0(2y ago)344553MITPHPPHP ^8.1

Since May 22Pushed 1y agoCompare

[ Source](https://github.com/surgiie/blade-cli)[ Packagist](https://packagist.org/packages/surgiie/blade-cli)[ RSS](/packages/surgiie-blade-cli/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (48)Used By (0)

Blade CLI
=========

[](#blade-cli)

Abandoned
=========

[](#abandoned)

This has moved and been reworked and is no longer maintained, please use [illuminate-cli](https://github.com/surgiie/illuminate-cli)

The Blade CLI allows you to compile and save any textual files from the command line using Laravel's Blade engine.

[![tests](https://github.com/surgiie/blade-cli/actions/workflows/tests.yml/badge.svg)](https://github.com/surgiie/blade-cli/actions/workflows/tests.yml/badge.svg)

Installation
------------

[](#installation)

To install the binary, use composer globally:

`composer global require surgiie/blade-cli`

Use
---

[](#use)

As an example, let's say you have a file named `person.yml` in your current directory with the following content:

```
name: {{ $name }}
relationship: {{ $relationship }}
favorite_food: {{ $favoriteFood }}
@if($includeAddress)
address: 123 example lane
@endif
```

You can render this file using the following command:

```
blade render ./person.yml \
                --name="Bob" \
                --relationship="Uncle" \
                --favorite-food="Pizza" \
                --include-address
```

This will render the file and save it in the same directory with the name `person.rendered.yml` with the following contents:

```
name: Bob
relationship: Uncle
favorite_food: Pizza
address: 123 example lane
```

Rendering With Docker:
----------------------

[](#rendering-with-docker)

If you don't have or want to install php, you can run render files using the provided script which will run the cli render command in a temporary docker container and use volumes to mount the neccessary files and then sync them back to your host machine:

```
cd /tmp

wget https://raw.githubusercontent.com/surgiie/blade-cli/master/docker

chmod +x ./docker

mv ./docker /usr/local/bin/blade

blade  --var="example"
```

Custom Filename
---------------

[](#custom-filename)

By default, all files will be saved to the same directory as the file being rendered with the name `.rendered.` or simply `.rendered`, to prevent overwriting the original file. To use a custom file name or change the directory, use the `--save-to` option to specify a file path:

```
blade render ./person.yml \
            ...
            --save-to="/home/bob/custom-name.yml"
```

**Note**: The cli will automatically create the necessary parent directories if it has permission, otherwise an error will be thrown.

Variable Data
-------------

[](#variable-data)

There are three options for passing variable data to your files being rendered, in order of precedence:

- Use YAML files with the `--from-yaml` option and pass a path to the file. This option can be used multiple times to load from multiple files.
- Use JSON files with the `--from-json` option and pass a path to the file. This option can be used multiple times to load from multiple files.
- Use env files with the `--from-env` option and pass a path to the .env file. This option can be used multiple times to load from multiple files.
- Use arbitrary command line options with the render command, like `--example-var=value`.

Variable Naming Convention
--------------------------

[](#variable-naming-convention)

Your env, YAML, and JSON file keys can be defined in any naming convention, but the actual variable references MUST be in camel case. This is because PHP does not support kebab case variables and since this is the format used in command line options, all variables will automatically be converted to camel case. For example, if you pass an option or define a variable name in your files in any of these formats: `favorite-food`, `favoriteFood`, or `favorite_food`, the variable for that option should be referenced as `$favoriteFood` in your files.

### Command Line Variable Types

[](#command-line-variable-types)

The following types of variables are currently supported:

- String/Single Value Variables: Use a single option key/value format, e.g. `--foo=bar --bar=baz`
- Array Value Variables: Pass the option multiple times, e.g. `--names=Steve --names=Ricky --names=Bob`
- True Boolean Value Variables: Pass the option with no value, e.g. `--should-do-thing`

**Note**: Since variable options are dynamic, "negate/false" options are not supported. Instead, use something like `{{ $shouldDoSomething ?? false }}` in your files to default to false and use true options to "negate" the value.

Force Write
-----------

[](#force-write)

If you try to render a file that already exists, an exception will be raised. To force overwrite an existing file, use the --force flag:

```
blade render ./person.yml \
                --name="Bob" \
                --relationship="Uncle" \
                --favorite-food="Pizza" \
                --include-address \
                --force # force overwrite person.rendered.yml if it already exists.
```

Dry Run/Show Rendered Contents
------------------------------

[](#dry-runshow-rendered-contents)

To view the contents of a rendered file without saving it, use the --dry-run flag when rendering a single file:

`blade render example.yaml --some-var=example --dry-run`

This will display the contents of example.yaml on the terminal without saving it.

Processing an entire directory of files
---------------------------------------

[](#processing-an-entire-directory-of-files)

You can also pass a directory path instead of a single file when running the command. This can be useful when you want to render multiple template files at once.

`blade render ./templates --save-dir="/home/bob/templates" --some-data=foo`

**Note**: This command will prompt you for confirmation. To skip confirmation, add the `--force` flag.

**Note**: When rendering an entire directory, the `--save-dir` option is required to export all rendered files to a separate directory. The directory structure of the directory being processed will be mirrored in the directory where the files are saved. In the above example, `/home/bob/templates` will have the same directory structure as `./templates`.

Custom Compiled Directory
-------------------------

[](#custom-compiled-directory)

When compiling a file down to plain php, the compiled file is stored by default in `/tmp/.blade-cli`, if you wish to use a custom directory for these files, you may use the `--cache-path` option:

`blade render myfile --var=foo --cache-path="/custom/directory"`

When clearing the directory, this will also be required:

`blade clear --cache-path="/custom/directory"`

Or you can persist the path via the `BLADE_CLI_CACHE_PATH` environment variable if you dont wish to pass it to every command call.

### Contribute

[](#contribute)

Contributions are always welcome in the following manner:

- Issue Tracker
- Pull Requests
- Discussions

### License

[](#license)

The project is licensed under the MIT license.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 99.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Recently: every ~60 days

Total

43

Last Release

902d ago

Major Versions

v0.1.2 → v1.0.02022-07-09

v1.0.3 → v2.0.02022-08-19

v2.0.7 → v3.0.02022-11-10

v3.11.0 → v4.0.02023-10-23

PHP version history (2 changes)v2.0.0PHP ^8.0

v4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/87e7d9a71eca01aac132fec3f1cdda21e373c87662d8998981412333acd828b6?d=identicon)[surgiie](/maintainers/surgiie)

---

Top Contributors

[![surgiie](https://avatars.githubusercontent.com/u/12025002?v=4)](https://github.com/surgiie "surgiie (200 commits)")[![jals-es](https://avatars.githubusercontent.com/u/31510870?v=4)](https://github.com/jals-es "jals-es (1 commits)")

---

Tags

bladeblade-template-engineclilaraveltemplatingtemplating-tool

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/surgiie-blade-cli/health.svg)

```
[![Health](https://phpackages.com/badges/surgiie-blade-cli/health.svg)](https://phpackages.com/packages/surgiie-blade-cli)
```

###  Alternatives

[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k57.4M685](/packages/drush-drush)[chromatic/usher

A collection of Robo commands for use on Chromatic projects.

13534.3k1](/packages/chromatic-usher)[platformsh/cli

Platform.sh CLI

23238.0k](/packages/platformsh-cli)[mehrancodes/laravel-harbor

A CLI tool to Quickly create On-Demand preview environment for your apps.

9989.0k](/packages/mehrancodes-laravel-harbor)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
