This package allows you to easily and quickly generate symlinks of any given files and or directories.
-
Ensure you have and are running PHP 7 and above
-
Fully Objected Oriented
-
Chained methods
-
Interactive API
Run the following command:
composer require simtabi/symlink
If you want to use within a class/project, install the project via composer and user as follows:
use Simtabi\Symlink;
$symlinkInit = new Symlink();
$obj = $symlinkInit->setBatchJobs([
[
'destination' => 'path_to_destination/folder_name_1',
'source' => 'path_to_create_file/folder_name',
],
[
'destination' => 'path_to_destination/folder_name_1',
'source' => 'path_to_create_file/folder_name',
]
])
->generate();
In this use-case, you have to provide an array
list of the path to the file/link to be
created a symlink for and the destination path and file alias
name. To achieve
this, use the following method.
->setBatchJobs([
// sources here
'destination' => 'path_to_destination/folder_name_1',
'source' => 'path_to_create_file/folder_name',
]);
In this use-case, you have to provide an array
list of the path to the file/link to be
created a symlink for and the destination path and file alias
name. To achieve
this, use the following method.
->setSource( 'source')->setDestination('destination');
If you want to use within a file and you don't need composer setup, I have
initialized a composer autoload for you and all you have to do is
require/include the composer autoload file within the location where
you want to use it. In this case we assume: include_once 'vendor/autoload.php';
See included test.php
file for more examples.
include_once 'symlink/src/Symlink.php';
use Simtabi\Symlink;
$symlinkInit = new Symlink();
$symlinkInit
->setSource( 'source')
->setDestination('destination')
->generate();
These are the available methods.
->setSource($source) // define source path
->setDestination($destination) // define destination path
->setGenerated(string $generated, $key) // capture and store all registered links
->setMessages(string $messages, $key) // capture and store all error messages
->setBatchJobs(array $batchJobs) // define multiple symlinks to be created
->getSource() // get source path
->getDestination() // get destination path
->getGenerated() // get all stored registered links
->getMessages() // get all stored error messages
->getBatchJobs() // get all symlinks to be created
When the $echo
is set to TRUE
, it will output the error messages to the screen.
->generate($echo = true) // generate method.
Please see Releases for more information what has changed recently.
Pull requests are more than welcome. You must follow the PSR coding standards.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
© 2020 Simtabi, LLC
The MIT License (MIT). Please see LICENSE for more information.