royvoetman/laravel-gitlab-storage

A Gitlab Storage driver for Laravel

v2.1.0 2024-04-28 14:39 UTC

This package is auto-updated.

Last update: 2024-04-28 14:45:15 UTC


README

68747470733a2f2f7777772e726f79766f65746d616e2e6e6c2f696d616765732f7061636b616765732f6c61726176656c2d6769746c61622e737667

A Gitlab Storage driver for Laravel

Latest Version MIT Licensed Total Downloads

This package is a wrapper bridging Flysystem-Gitlab-storage into Laravel as an available storage disk.

Installation

composer require royvoetman/laravel-gitlab-storage

Add a new disk to your filesystems.php config

'gitlab' => [
    'driver'                => 'gitlab',
    'personal-access-token' => env('GITLAB_ACCESS_TOKEN', ''), // Personal access token
    'project-id'            => env('GITLAB_PROJECT_ID'), // Project id of your repo
    'branch'                => env('GITLAB_BRANCH', 'master'), // Branch that should be used
    'base-url'              => env('GITLAB_BASE_URL', 'https://gitlab.com'), // Base URL of Gitlab server you want to use
],

Access token (required for private projects)

Gitlab supports server side API authentication with Personal Access tokens

For more information on how to create your own Personal Access token: Gitlab Docs

Project ID

Every project in Gitlab has its own Project ID. It can be found at to top of the frontpage of your repository. See

Base URL

This will be the URL where you host your gitlab server (e.g. https://gitlab.com)

Usage

$disk = Storage::disk('gitlab');

// create a file
$disk->put('images/', $fileContents);

// check if a file exists
$exists = $disk->exists('file.jpg');

// copy a file
$disk->copy('old/file1.jpg', 'new/file1.jpg');

// move a file
$disk->move('old/file1.jpg', 'new/file1.jpg');

// See https://laravel.com/docs/filesystem for a full list of all the available functionality

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.

Pull Requests

  • PSR-2 Coding Standard - The easiest way to apply the conventions is to install PHP Code Sniffer.
  • Document any change in behaviour - Make sure the README.md and any other relevant documentation are kept up-to-date.
  • Create feature branches - Don't ask us to pull from your master branch.
  • One pull request per feature - If you want to do more than one thing, send multiple pull requests.

License

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