PHP code example of ryanve / slash

1. Go to this page and download the library: Download ryanve/slash library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ryanve / slash example snippets


\slash\Uri::scheme($uri) // get scheme (excludes ':')
\slash\Uri::prorel($uri) // convert to protocol relative
\slash\Uri::prorel($uri, $scheme) // replace the scheme
\slash\Uri::bar($uri) // get "address bar" uri
\slash\Uri::authority($uri) // get authority
\slash\Uri::hostname($uri) // get hostname
\slash\Uri::prefetch($uri) // get uri for dns prefetch
\slash\Uri::userinfo($uri) // get userinfo
\slash\Uri::user($uri) // get username
\slash\Uri::pass($uri) // get password
\slash\Uri::port($uri) // get port number (string)
\slash\Uri::hier($uri) // get hierarchial part
\slash\Uri::path($uri) // get path part
\slash\Uri::query($uri) // get query str (excludes '?')
\slash\Uri::hash($uri) // get fragment  (

\slash\Slash::trim($path)
\slash\Slash::ltrim($path)
\slash\Slash::rtrim($path)
\slash\Slash::slash($path)
\slash\Slash::lslash($path)
\slash\Slash::rslash($path)
\slash\Slash::join(*$parts)
\slash\Slash::split($path)
\slash\Slash::normalize($path)

\slash\File::exists($path)
\slash\File::get($path, $done?)
\slash\File::put($path, $data)
\slash\File::load($path, $done)
\slash\File::getJson($path, $done?)
\slash\File::putJson($path, $data)

\slash\Path::normalize($path)
\slash\Path::root($relative?)
\slash\Path::dir($relative?)
\slash\Path::ext($path, $add?)
\slash\Path::filename($file)
\slash\Path::inc($file)
\slash\Path::scan($path?)
\slash\Path::tree($path?)
\slash\Path::paths($path?)
\slash\Path::files($path?)
\slash\Path::dirs($path?)
\slash\Path::exists($item)
\slash\Path::isPath($item)
\slash\Path::isFile($item)
\slash\Path::isDir($item)
\slash\Path::isDot($item)
\slash\Path::isAbs($path) // test if path is absolute
\slash\Path::toAbs($path) // resolve relative path
\slash\Path::toUri($path, $scheme?) // defaults to protocol-relative
\slash\Path::toUrl($path, $scheme?) // defaults to http or https
\slash\Path::isHttps()
\slash\Path::mtime($path)
\slash\Path::ctime($path)
\slash\Path::atime($path)
\slash\Path::affix($list, $prefix, $suffix?)
\slash\Path::infix($list, $infix)
\slash\Path::depth($path)
\slash\Path::tier($array)
\slash\Path::sort($array)
\slash\Path::locate($needles)
\slash\Path::contains($haystack, $needle)
\slash\Path::search($paths, $needles?)
\slash\Path::find($list, $test)

::mixin($name, $fn) // mixin a single method
::mixin($array) // mixin methods from an associative array
::mixin($object) // mixin methods from an object or class
::method($name) // fully-qualify a method (returns callable)
::methods($object?) // get array of all methods incl. mixins