Gitlab Adapter

Installation

composer require royvoetman/flysystem-gitlab-storage

Usage

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

// Create FileSystem
$filesystem = new Filesystem($adapter);

// write a file
$filesystem->write('path/to/file.txt', 'contents');

// update a file
$filesystem->update('path/to/file.txt', 'new contents');

// read a file
$contents = $filesystem->read('path/to/file.txt');

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)

See the project README for additional usage examples.