- How do I use this package with Laravel’s Storage facade?
- First, add the package via Composer and configure a `gitlab` disk in `config/filesystems.php`. Then use Laravel’s Storage facade like any other disk: `Storage::disk('gitlab')->put('file.txt', 'content');`. The companion package `royvoetman/laravel-gitlab-storage` simplifies this further with `GitlabStorage::disk()`.
- What Laravel and PHP versions does this package support?
- This package supports Laravel 8+ and PHP 7.1–8.2. For older Flysystem versions (1 or 2), use specific tags like `v1.1.0` or `v2.0.4`. Always check the [README](https://github.com/RoyVoetman/Flysystem-Gitlab-storage) for the latest compatibility details.
- How do I handle files with spaces or special characters in filenames?
- The package resolves this with `rawurlencode()` in v3.1.1, which fixes GitLab’s API restrictions on spaces/special characters. Ensure you’re using the latest version to avoid 400 errors. Test thoroughly if your app relies on such filenames.
- Can I use this for CI/CD artifact storage instead of GitLab’s native artifacts?
- Yes, but consider GitLab’s API rate limits (60 requests/minute for unauthenticated users) and LFS quotas (default 10GB). For high-throughput pipelines, cache frequently accessed files or use hybrid storage (e.g., S3 for large files).
- What’s the difference between this package and GitLab’s native LFS?
- This package uses GitLab’s Repository Files API v4 for direct file storage in a branch, while LFS is optimized for large files (>10MB). Use this for version-controlled assets or metadata; pair with LFS for binaries. Both benefit from Git history and diffs.
- How do I secure my GitLab personal access token?
- Store the token in Laravel’s `.env` file and restrict its permissions to only what’s needed (e.g., `api` scope). Avoid hardcoding tokens in config files. For added security, use GitLab deploy keys or CI/CD job tokens instead of personal tokens.
- Will this work with self-hosted GitLab instances?
- Yes, this package supports any GitLab instance (e.g., `https://gitlab.example.com`). Configure the `base_url` in your filesystem settings to point to your self-hosted instance. Ensure your GitLab version supports API v4.
- How do I handle concurrent write conflicts when multiple users upload files?
- GitLab’s API may return conflicts if files are modified simultaneously. Mitigate this by using isolated branches (e.g., `feature/*`) for writes or implementing a retry mechanism with exponential backoff in your application logic.
- Are there alternatives to this package for GitLab storage?
- For Laravel, the companion package `royvoetman/laravel-gitlab-storage` extends functionality. For broader Flysystem support, explore `league/flysystem` with custom adapters, but this package is the most direct solution for GitLab’s Repository Files API v4.
- How do I monitor storage usage or enforce quotas in GitLab?
- GitLab’s API doesn’t provide native quota monitoring, but you can track usage via the [Projects API](https://docs.gitlab.com/ee/api/projects.html). For quotas, use GitLab’s LFS limits or implement application-level checks. Consider archiving old files or offloading to S3 for large projects.