royvoetman/flysystem-gitlab-storage

Flysystem Adapter for the Gitlab Repository files API v4

v3.1.0 2024-04-28 14:24 UTC

This package is auto-updated.

Last update: 2024-10-28 15:44:15 UTC


README

A Gitlab Storage filesystem for Flysystem.

Latest Version MIT Licensed Total Downloads

This package contains a Flysystem adapter for Gitlab. Under the hood, Gitlab's Repository (files) API v4 is used.

For Flysystem 2 (PHP 7.4) use version 2.0.4

For Flysystem 1 (PHP 7.1) use version 1.1.0

Installation

composer require royvoetman/flysystem-gitlab-storage

Integrations

Usage

// Create a Gitlab Client to talk with the API
$client = new Client('project-id', 'branch', 'base-url', 'personal-access-token');
   
// Create the Adapter that implements Flysystems AdapterInterface
$adapter = new GitlabAdapter(
    // Gitlab API Client
    $client,
    // Optional path prefix
    'path/prefix',
);

// The FilesystemOperator
$filesystem = new League\Flysystem\Filesystem($adapter);

// see http://flysystem.thephpleague.com/api/ for full list of available functionality

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)

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

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.