A Gitlab Storage filesystem for Flysystem.
This package contains a Flysystem adapter for Gitlab. Under the hood, Gitlab's Repository (files) API v4 is used.
composer require royvoetman/flysystem-gitlab-storage// 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'); // check if a file exists $exists = $filesystem->has('path/to/file.txt'); // delete a file $filesystem->delete('path/to/file.txt'); // rename a file $filesystem->rename('filename.txt', 'newname.txt'); // copy a file $filesystem->copy('filename.txt', 'duplicate.txt'); // delete a directory $filesystem->deleteDir('path/to/directory'); // see http://flysystem.thephpleague.com/api/ for full list of available functionalityGitlab supports server side API authentication with Personal Access tokens
For more information on how to create your own Personal Access token: Gitlab Docs
Every project in Gitlab has its own Project ID. It can be found at to top of the frontpage of your repository. See
This will be the URL where you host your gitlab server (e.g. https://gitlab.com)
For the purpose of debugging does the adaptor have a build in debug mode. This is especially useful for debugging the authentication layer of the Gitlab API that is based purely on HTTP messages/ status codes. By default this mode is disabled, and this can be check by calling the isDebugEnabled method on the adapter. Enabling debugging mode can be done with either of the following two options:
$adapter = new GitlabAdapter($client, '', true); // Third parameter defines debug mode$adapter->setDebug(true);Please see CHANGELOG for more information what has changed recently.
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
- 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.mdand 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.
The MIT License (MIT). Please see License File for more information.