PHP code example of laradic / support

1. Go to this page and download the library: Download laradic/support 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/ */

    

laradic / support example snippets


echo path_join('/var/www/vhost', '..', 'myhost', 'config.ini');
// => /var/www/myhost/config.ini

echo path_get_directory('/var/www/vhost/laradic/config.ini');
// => vhost

echo path_canonicalize('/var/www/vhost/laradic/../config.ini');
// => /var/www/vhost/config.ini
// => C:/Programs/config.ini

echo path_make_absolute('config/config.yml', '/var/www/project');
// => /var/www/project/config/config.yml

echo path_make_relative('/var/www/project/config/config.yml', '/var/www/project/uploads');
// => ../config/config.yml

$paths = array(
    '/var/www/vhosts/project/httpdocs/config/config.yml',
    '/var/www/vhosts/project/httpdocs/images/banana.gif',
    '/var/www/vhosts/project/httpdocs/uploads/../images/nicer-banana.gif',
);
path_get_longest_common_base_path($paths);
// => /var/www/vhosts/project/httpdocs

path_get_filename('/views/index.html.twig');
// => index.html.twig

path_get_filename_without_extension('/views/index.html.twig');
// => index.html

path_get_filename_without_extension('/views/index.html.twig', '.html.twig');
// => index

path_get_extension('/views/index.html.twig');
// => twig

path_has_extension('/views/index.html.twig');
// => true

path_has_extension('/views/index.html.twig', 'twig');
// => true

path_has_extension('/images/profile.jpg', array('jpg', 'png', 'gif'));
// => true

path_change_extension('/images/profile.jpeg', 'jpg');
// => /images/profile.jpg

path_get_home_directory();