utopia-php / vcs
A simple library to integrate version control systems like GitHub, GitLab etc. to receive webhook events
Installs: 29 448
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 6
Forks: 0
Open Issues: 4
Requires
- php: >=8.0
- adhocore/jwt: ^1.1
- utopia-php/cache: 0.10.*
- utopia-php/framework: 1.0.*
- utopia-php/system: 0.9.*
Requires (Dev)
- laravel/pint: 1.2.*
- phpstan/phpstan: 1.8.*
- phpunit/phpunit: ^9.4
- dev-main
- 0.9.1
- 0.9.0
- 0.9.0-RC1
- 0.8.x-dev
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- dev-feat-fetch-commit-author
- dev-feat-author-avatar
- dev-feat-add-avatar0url
- dev-chore-remove-exceptException
- dev-feat-add-search-repos
- dev-fix-search-repos
- dev-refactor-cache-calls-signature
- dev-bump-cache-lib-ver
- dev-fix-update-framework-version
- dev-fix-clone-gitignore
- dev-feat-gitlab-adapter
- dev-fix-deno-install-command
- dev-fix-vcs-errors
- dev-fix-dart-commands
- dev-chore-update-deps
- dev-feat-clone-commit-hash
- dev-feat-git-adapter
This package is auto-updated.
Last update: 2024-11-11 18:37:28 UTC
README
Utopia VCS is a simple and lite library for interacting with version control systems (VCS) in Utopia-PHP using adapters for different providers like GitHub, GitLab etc. This library is aiming to be as simple and easy to learn and use. This library is maintained by the Appwrite team.
Getting Started
Install using composer:
composer require utopia-php/vcs
Init in your application:
<?php require_once __DIR__ . '/../../vendor/autoload.php'; use Utopia\VCS\Adapter\Git\GitHub; // Initialise your adapter $github = new GitHub(); // Your GitHub app private key. You can generate this from your GitHub App settings. $privateKey = 'your-github-app-private-key'; // Your GitHub App ID. You can find this in the GitHub App dashboard. $githubAppId = 'your-github-app-id'; // Your GitHub App installation ID. You can find this in the GitHub App installation settings. $installationId = 'your-github-app-installation-id'; // Initialise variables $github->initializeVariables($installationId, $privateKey, $githubAppId); // Perform the actions that you want, ex: create repository $owner = '<repository-owner>'; $name = '<repository-name>'; $isPrivate = true; // Set to false if you want to create a public repository $repository = $github->createRepository($owner, $name, $private);
Environment Variables
To configure your GitHub App properly, you'll need to set up the following environment variables in your environment or configuration file. These values are crucial for authenticating and interacting with the GitHub API on behalf of your GitHub App.
- PRIVATE_KEY: You can generate this from your GitHub App settings.
PRIVATE_KEY = your-github-app-private-key
- GITHUB_APP_ID: You can find this in the GitHub App dashboard.
GITHUB_APP_ID = your-github-app-id
- INSTALLATION_ID: You can find this in the GitHub App installation settings after installation.
INSTALLATION_ID = your-github-app-installation-id
Remember to replace the placeholders (your-github-app-private-key, your-github-app-id, and your-github-app-installation-id) with the actual values from your GitHub App configuration. By using these environment variables, you can ensure that sensitive information is kept separate from your codebase and can be easily managed across different environments without exposing sensitive data.
Supported Adapters
VCS Adapters:
Detector Adapters:
✅ - supported, 🛠 - work in progress
System Requirements
Utopia VCS requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
Contributing
All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.
Fork the project, create a feature branch, and send us a pull request.
You can refer to the Contributing Guide for more info.
Tests
To run tests, you first need to bring up the example Docker stack with the following command:
docker compose up -d --build
To run all unit tests, use the following Docker command:
docker compose exec tests ./vendor/bin/phpunit
Copyright and license
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php