Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Gitlab Api

Php Gitlab Api Laravel Package

m4tthumphrey/php-gitlab-api

A modern GitLab API v4 client for PHP, inspired by php-github-api. Install via Composer; requires PHP 8.1-8.5 plus PSR-18 HTTP client and PSR-17 factory implementations.

View on GitHub
Deep Wiki
Context7

m4thumphrey/php-gitlab-api is a modern GitLab API v4 client for PHP, inspired by the widely used php-github-api. Install it via Composer and provide PSR-compatible HTTP client and factory implementations to interact with GitLab projects, users, issues, merge requests, and more.

  • Supports PHP 8.1–8.5 with PSR-18 HTTP clients and PSR-17 factories
  • Clean, resource-oriented API for common GitLab operations
  • Built for GitLab API v4
  • Part of a familiar client family alongside GitHub and Bitbucket libraries
  • Actively maintained with tests, releases, and contribution guidelines
Frequently asked questions about Php Gitlab Api
How do I integrate this GitLab API client with Laravel for project management?
Use the `graham-campbell/gitlab` package, which provides Laravel service providers, facades, and Eloquent models. Install it via `composer require graham-campbell/gitlab`, publish the config with `php artisan vendor:publish`, and set your `GITLAB_TOKEN` and `GITLAB_URL` in `.env`. Then call `$projects = GitLab::projects()->all()` to list projects.
Does this package support OAuth2 authentication for GitLab SSO in Laravel?
Yes, the core `m4tthumphrey/php-gitlab-api` supports OAuth2, but the Laravel-specific `graham-campbell/gitlab` package primarily uses personal access tokens. For OAuth2, configure the client manually with your OAuth2 provider and handle token refreshes via Laravel’s session or cache.
What Laravel versions are compatible with this GitLab API client?
The package works with Laravel 9 and 10, as it relies on PSR-18 HTTP clients (like Guzzle) that Laravel natively supports. Ensure your Laravel app uses PHP 8.1–8.5, which aligns with the package’s requirements.
How do I handle pagination for large GitLab API responses in Laravel?
The client includes a `ResultPager` class to simplify pagination. Use it like `$projects = GitLab::projects()->allWithPagination();` to fetch paginated results. For Laravel queues, wrap paginated calls in a job to avoid timeouts.
Can I use this package for self-hosted GitLab instances?
Yes, set the `GITLAB_URL` in your `.env` to your self-hosted instance (e.g., `https://gitlab.yourdomain.com`). The package supports custom URLs and instance-specific APIs, but verify webhook reliability and rate limits for your setup.
What’s the best way to test GitLab API interactions in Laravel?
Mock HTTP responses using Laravel’s `Http::fake()` or libraries like VCR for recording. For unit tests, inject a mock PSR-18 client into the GitLab service container. Example: `Http::fake(['*' => Http::response(['id' => 1])]);`
Does this package support GitLab CI/CD pipeline triggers from Laravel?
Yes, use the `GitLab::projects()->pipelines()->create()` method to trigger pipelines. For Laravel queues, dispatch a job with the pipeline trigger logic to avoid blocking requests. Example: `PipelineTriggerJob::dispatch($projectId, $ref);`
What are the alternatives to this GitLab API package for Laravel?
Alternatives include the official `gitlab/gitlab-php` (less Laravel-friendly) or `spatie/laravel-gitlab` (simpler but less feature-rich). This package stands out for its PSR compliance, modern PHP support, and Laravel-specific integrations like facades and Eloquent models.
How do I customize the HTTP client (e.g., add retries or middleware) in Laravel?
Override the default client in the `GitLabServiceProvider`. Example: Bind a custom Guzzle client with middleware: `$client = new Client([ 'timeout' => 30, 'headers' => ['User-Agent' => 'MyApp/1.0'] ]);` and inject it into the GitLab client.
Are there any known limitations with GitLab’s API v4 coverage in this package?
The package covers ~90% of GitLab’s REST API v4 but lacks support for newer features like Webhooks v4 or GraphQL. Monitor GitLab’s API deprecations and check the [changelog](https://github.com/GitLabPHP/Client/releases) for updates. For unsupported endpoints, use raw HTTP requests via the PSR-18 client.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo