Skip to content

simtabi/symlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alt text

Symlink Helper

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

Getting Started

1. Install

Run the following command:

composer require simtabi/symlink

2. Use case scenarios.

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();

1. Create multiple symlinks at ago.

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',
]);

2. Create a single symlink at ago.

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');

3. Using it.

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();

3. API Methods

These are the available methods.

Setters

->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

Getters

->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

Generate

When the $echo is set to TRUE, it will output the error messages to the screen.

->generate($echo = true) // generate method. 

Changelog

Please see Releases for more information what has changed recently.

Contributing

Pull requests are more than welcome. You must follow the PSR coding standards.

Security

If you discover any security related issues, please email security@simtabi.com instead of using the issue tracker.

Credits

Copyright

© 2020 Simtabi, LLC

License

The MIT License (MIT). Please see LICENSE for more information.

About

Small utility class to help create symlinks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages