Download the PHP package tcb13/substringy without Composer

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

A PHP SubString manipulation library with multibyte support that extends Stringy. Offers OO method chaining. Tested and compatible with PHP 5.4+ and HHVM.

This library extends and adds SubString functionality to danielstjules/Stringy you should check it's documentation for methods inherited by SubStringy.

Build Status

Installation

If you're using Composer to manage dependencies, you can include the following in your composer.json file:

Then, after running composer update or php composer.phar update, you can load the class using Composer's autoloading:

Otherwise, you can simply require the file directly:

And in either case, I'd suggest using an alias.

OO and Chaining

The library offers OO method chaining, as seen below:

Stringy\Stringy has a __toString() method, which returns the current string when the object is used in a string context, ie: (string) S::create('foo') // 'foo'

Use as a Trait

The library also offers the possibility to be used a trait. With this trait you can build your own abstraction of danielstjules/Stringy and combine multiple extensions:

On the example bellow we can use MyStringy to create Stringy objects enhanced with the functionality of both SubStringy and SliceableStringy:

Implemented Interfaces

SubStringy\SubStringy implements the IteratorAggregate interface, meaning that foreach can be used with an instance of the class:

It implements the Countable interface, enabling the use of count() to retrieve the number of characters in the string:

Furthermore, the ArrayAccess interface has been implemented. As a result, isset() can be used to check if a character at a specific index exists. And since Stringy\Stringy is immutable, any call to offsetSet or offsetUnset will throw an exception. offsetGet has been implemented, however, and accepts both positive and negative indexes. Invalid indexes result in an OutOfBoundsException.

PHP 5.6 Creation

As of PHP 5.6, use function is available for importing functions. SubStringy exposes a namespaced function, SubStringy\create, which emits the same behaviour as SubStringy\SubStringy::create(). If running PHP 5.6, or another runtime that supports the use function syntax, you can take advantage of an even simpler API as seen below:

Methods

All methods that return a SubStringy object or string do not modify the original. SubStringy objects are immutable.

Since this library extends and adds SubString functionality to danielstjules/Stringy you should check it's documentation (https://github.com/danielstjules/Stringy/blob/master/README.md) for methods that can also be transparently used when working with SubStringy.

Note: If $encoding is not given, it defaults to mb_internal_encoding().

substringAfterFirst

$stringy->substringAfterFirst(string $separator)

Gets the substring after the first occurrence of a separator. If no match is found returns false.

substringAfterLast

$stringy->substringAfterLast(string $separator)

Gets the substring after the last occurrence of a separator. If no match is found returns false.

substringBeforeFirst

$stringy->substringBeforeFirst(string $separator)

Gets the substring before the first occurrence of a separator. If no match is found returns false.

substringBeforeLast

$stringy->substringBeforeLast(string $separator)

Gets the substring before the last occurrence of a separator. If no match is found returns false.

substringBetween

$stringy->substringBetween(string $start, string $end)

Extracts a substring from between two substrings present on the current string.

substringCount

$stringy->substringCount(string $substr)

Count the number of substring occurrences on the current string

Links

The following is a list of libraries that extend Stringy:

Tests

From the project directory, tests can be ran using phpunit

License

Released under the MIT License - see LICENSE.txt for details.


All versions of substringy with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-mbstring Version *
danielstjules/stringy Version ^3.1
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 tcb13/substringy contains the following files

Loading the files please wait ....