Download the PHP package emsifa/stuble without Composer

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

STUBLE

Stuble is command line tool built with PHP to simplify working with stubs. Stuble will collect parameters in your stub(s) file(s) and ask you those parameters. So you don't need to write scripts to handle each stub file.

Stuble

REQUIREMENTS

INSTALLATION

Make sure you have register composer bin directory to your PATH variable. You can read this for more information.

USAGE EXAMPLE

Before we get started, you need to know that stuble scan stubs files from 2 locations.

  1. Local source: stubs directory wherever you want to use stuble command.
  2. Global source: stubs directory inside STUBLE_HOME path.

If same stub file found in 2 sources, stuble will use local stub file.

Make Stub File

In your cmd/terminal, go to directory wherever you want to try stuble.

For example we are in /home/me/coding/try-stuble.

Then create file stubs/model.stub in that directory:

Generate File From Stub

Back to cmd/terminal and run command below:

Then stuble will scan needed parameters in our stubs/model.stub (in this example model_namespace, and entity), then ask values for those parameters, finally stuble will ask where do you want to save the file.

For example if you fill:

Stuble will generate app/Models/ProductCategory.php with content:

If you look at your model.stub again, you may realize things like:

THINGS YOU NEED TO KNOW

Using Global Source

If you want to use global source, you should define STUBLE_HOME in your environment variable.

For linux, you can add line below to your ~/.bashrc or ~/.zshrc file.

Then make stubs directory inside that path.

Generate Stubs in a Directory

Just put path/to/directory instead path/to/filename in stuble make command. Stuble will collect parameters in stubs files inside that directory. Then generate results files.

For example if your stubs directory has structure like this:

You can use stuble make laravel-scaffolds to generate controller, factory, migration, model, resource, store-request, and update-request.

Define Output File Path in Stub File

If you have your own standard filepath and don't want stuble ask for output filepath every stuble make that stub, you can add line below at very top of your stub file:

Example:

Now if you create file from that stub, stuble won't ask you output filepath. Instead stuble will automatically put file using that format.

Append to Existing File

You can also append existing file instead of creating new file each make stub file.

For example you want to append some code into laravel routes file:

Then whenever you make that stub file, Route::resource(...) will be appended to very bottom of routes/web.php file.

You may realize now that code inside === and === is in TOML format. Actually, it can be YAML too :)

You can also append code in specific line, or after/before some code.

Append to specific line:

Now whenever you make that stub file, Route::resource(...) will always appended to line 15 in routes/web.php file.

Append after specific code:

Now whenever you make that stub file, Route::resource(...) will always appended after line that contain "// Generated by Stuble".

Append before specific code:

Now whenever you make that stub file, Route::resource(...) will always appended before line that contain "// Code aboves was generated by Stuble".

Built-in Filters

Filter Description Value Result
lower Transform value to lower case. ProductCategory productcategory
upper Transform value to upper case. ProductCategory PRODUCTCATEGORY
ucfirst Make first letter capital. product category Product category
ucwords Make first letter in each words capital. product category Product Category
kebab Transform value to kebab-case/dash-case. ProductCategory product-category
snake Transform value to snake_case. ProductCategory product_category
camel Transform value to camelCase. product category productCategory
pascal Transform value to PascalCase. product category ProductCategory
studly Alias pascal. product category ProductCategory
title Transform value to Title Case. product_category Product Category
words Transform value to words. product_category product category
plural Transform value to plural form. product_category product_categories
singular Transform value to singular form. ProductCategories ProductCategory
replace(str, to) Replace string in value. "Foo\Bar\Baz".replace("\", "/") Foo/Bar/Baz

Make Your Own Filter

In this example we will add filter substr.

In your stubs directory, create file stuble-init.php. Write code below:

Then you can use it like this.

You can use that filter in all stubs file inside that directory, including subdirectories too. If you have same filter in subdirectory, stuble will override it.

Show List Available Stubs

You can use command stuble ls to show list available stubs.

For example:

Dump Result

If you want to dump result instead of save it, you can use --dump in stuble make command.

For example:

Transform Existing File to Stubs Files (Experimental)

If you want to convert some of your files into stubs file, you can use stublify command.

For example you have modules/users directory that contain CRUD for users, you can convert it to stubs by running command:

This will convert files in modules/users directory to .stub files in stubs/my-modules directory.

After you run this command, stuble will ask you if you want to replace some texts with parameters. Stuble also able to detect other formats of your text. For example you want to replace "User" to entity. Stuble will ask you if you want to replace "Users" with entity.plural, "users" with entity.plural.lower, etc.


All versions of stuble with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.3
doctrine/inflector Version ^1.3
yosymfony/toml Version ^1.0
symfony/yaml Version ^5.3
guzzlehttp/guzzle Version ^7.4
symfony/console Version ^5.3
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 emsifa/stuble contains the following files

Loading the files please wait ....