fghazaleh/cport

PHP support library for Array and String PHP function

1.1.0 2021-10-05 16:20 UTC

This package is auto-updated.

Last update: 2024-05-06 22:03:12 UTC


README

cport is a PHP support library wrapping Array and String PHP functions.

$string = 'This is my first string';

$str = new \FG\Support\Strings\Str($string);
// or
$str = \FG\Support\Strings\Str::fromString($string);

Build-in methods in Str class.

  • trim, rtrim, ltrim
  • length
  • toUpper, toLower, toUpperFirst, toLowerFirst
  • replace
  • subString
  • appendAfter, appendBefore
  • stripTags
  • reverse
  • toMd5
  • startsWith, endsWith
  • indexOf
  • lastIndexOf
  • charAt, charCodeAt
  • camel, studly
  • contains, any
  • pad
  • parseQueryString
$array = [1, 2, 3, 4];

$arr = new \FG\Support\Arrays\Arr($array);
// or
$arr = \FG\Support\Arrays\Arr::createFrom($array);

Build-in methods in Arr class.

  • add
  • merge
  • slice
  • map
  • each
  • where
  • column
  • combine
  • diff
  • flip
  • sort
  • whereSort
  • keys, keyExists
  • first, last
  • all, count
  • sum