Download the PHP package victoryoalli/laravel-string-macros without Composer

On this page you can find all versions of the php package victoryoalli/laravel-string-macros. 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 laravel-string-macros

Laravel String Macros

GitHub release (latest by date) Packagist Downloads

A collection of useful string macros for Laravel's Str and Stringable classes.

Requirements

Version PHP Laravel
2.1+ ^8.2 10.x, 11.x, 12.x
2.0 ^8.1 10.x, 11.x
1.x ^8.0 8.x, 9.x, 10.x

Installation

Available Macros

All macros are available both as static methods on Str and as fluent methods on Stringable.

initials

Gets the initials of the words you provide. Defaults to 2 initials.

Note: Words are split by spaces, commas, underscores, and hyphens. For example, Jean-Pierre is treated as two words.

interpolate

Replaces ? placeholders with the values you provide.

readingMinutes

Calculates how many minutes it takes to read the text. Accepts HTML (tags are stripped for accurate calculation). Default reading speed is 200 words per minute.

linesCount

Counts the number of lines in a string (splits by \n or \r).

Fluent Chaining

All macros can be chained with other Stringable methods:


Upgrading from v1.x to v2.x

Breaking Changes

Removed Macros

The following macros have been removed because they are now available natively in Laravel 10+:

Removed Macro Use Instead Available Since
Str::human($value) Str::headline($value) Laravel 9.x
Str::matches($pattern, $value) Str::isMatch($pattern, $value) Laravel 10.x

Migration Examples

Before (v1.x):

After (v2.x) - Use Laravel native methods:

Note: Str::headline() capitalizes each word, while the old Str::human() did not. If you need lowercase output, chain with ->lower():

PHP and Laravel Version Requirements

Requirement v1.x v2.0 v2.1+
PHP ^8.0 ^8.1 ^8.2
Laravel 8.x, 9.x, 10.x 10.x, 11.x 10.x, 11.x, 12.x

Upgrade Steps

  1. Update your composer.json or run:

  2. Search and replace removed macros in your codebase:

  3. Replace with native Laravel methods:

    • Str::human()Str::headline()
    • Str::matches()Str::isMatch()
    • ->human()->headline()
    • ->matches()->isMatch()
  4. Run your tests to ensure everything works correctly.

Testing

Changelog

Please see CHANGELOG for more information about recent changes.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-string-macros with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.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 victoryoalli/laravel-string-macros contains the following files

Loading the files please wait ...