Download the PHP package lukeraymonddowning/stubble without Composer

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

Stubble

A simple templating language for .stub files in Laravel projects and packages.

What is Stubble for?

If you've ever built a package for Laravel, you've likely also created little .stub files that are published to the user's project when they run a certain command. Often, these stubs will feature dynamic content that is filled based on user input. For example, you may need to fill out a class name, or a namespace, or a filename based on the argument passed in to an Artisan command.

Usually, the actual value of the dynamic content is the same, but the format may need to change depending on its location; a filename might need to be kebab-cased, but a class name should be PascalCase. It's annoying to have to redefine all of these simple transformations to the same value just to publish a stub. What if there was a way to define these transformations inside the stub file? That's exactly what Stubble allows you to do.

Installation

You can install Stubble via Composer:

Usage

Imagine you're writing an Artisan command that publishes 2 files: a class and a blade view. The class references the blade view, but we don't want the user to have to specify the name of both; the blade view filename should be automatically determined by the name of the class. Let's imagine the command looks like this:

You have a stub file for the class that might look like this:

Here we have to create 2 replacement values: "class" and "view", but the fact of the matter is that the name of the view is the name of the class, just formatted in kebab-case rather than PascalCase. Let's rewrite our stub using stubble:

Note that we no longer have to reference 2 different variables. Instead, we add a modifier to the variable which describes how it should be transformed before being replaced.

Now, in our Artisan command, we can use the publish method to easily publish our stub to the user's application:

Stubble will take care of copying the file, performing the necessary content transformations, and publishing it to the new location.

Available Modifiers

Modifiers are the key to transforming content inside of your stub files. You can separate multiple modifiers with the pipe | character.

basename

The basename modifier will return the basename of a given class string:

camel

The camel modifier transforms the given value to camelCase.

classname

The classname modifier transforms a string to its fully qualified class name if possible:

kebab

The kebab modifier transforms the given value to kebab-case.

lower

The lower modifier transforms the given value to lowercase.

plural

The plural modifier transforms the given value to the plural version. For example, 'duck' would become 'ducks'.

singular

The singular modifier transforms the given value to the singular version. For example, 'ducks' would become 'duck'.

snake

The snake modifier transforms the given value to snake_case.

studly

The studly modifier transforms the given value to StudlyCase.

upper

The upper modifier transforms the given value to UPPERCASE.

view

The view modifier transforms a class string to a valid view destination:

Chaining multiple Modifiers

Modifiers can be chained together to perform multiple transformations. They will be applied in order from left to right. Modifiers are separated using the | character:

Adding new Modifiers

The Lukeraymonddowning\Stubble\Modifier class is Macroable, allowing you to define your very own modifiers. We suggest you do this in the boot method of your ServiceProvider. Each modifier should return a modified string value.

Replacing a file's contents without publishing

If you want to perform tag transformations on a file, but return it as a string to perform extra work on it, you can use the file method:

Converting values outside of stub files

Sometimes, you may want to use the power of Stubble outside of stub files, perhaps for the filename of a given stub. You can do that using the replace method:

Tip! When using the publish method, you can use tags directly in the $destinationPath argument for no sweat dynamic filenames.

Customising stub tags

By default, Stubble will use {{ and }} as the start and end of tags respectively. You are free to customise these locators using the defineTags method:


All versions of stubble with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^8.0
spatie/macroable Version ^1.0|^2.0
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 lukeraymonddowning/stubble contains the following files

Loading the files please wait ....