Download the PHP package surgiie/blade-cli without Composer

On this page you can find all versions of the php package surgiie/blade-cli. 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 blade-cli

Blade CLI

Abandoned

This has moved and been reworked and is no longer maintained, please use laravel-blade-cli

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

tests

Installation

To install the binary, use composer globally:

composer global require surgiie/blade-cli

Use

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

You can render this file using the following command:

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

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:

Custom Filename

By default, all files will be saved to the same directory as the file being rendered with the name <filename>.rendered.<extension> or simply <filename>.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:

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

Variable Data

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

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

The following types of variables are currently supported:

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

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:

Dry Run/Show 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

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

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

Contributions are always welcome in the following manner:

License

The project is licensed under the MIT license.


All versions of blade-cli with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.4
illuminate/http Version ^10.0
intonate/tinker-zero Version ^1.2
surgiie/console Version ^4.1.0
symfony/yaml Version ^6.2
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 surgiie/blade-cli contains the following files

Loading the files please wait ....