Gitlab Filesystem Adapter

Interacting with a gitlab repo through Flysystem can be done by using the RoyVoetman\FlysystemGitlab\GitlabAdapter.


composer require royvoetman/flysystem-gitlab-storage


// 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 Flysystem's AdapterInterface
$adapter = new GitlabAdapter(
    // Gitlab API Client
    // Optional path prefix

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

Project ID

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

Base URL

This will be the URL where you host your gitlab server (e.g.

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