WARNING: you're viewing docs for an outdated version. View the docs for the current version.

GitLab Adapter (V1)

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