cslant / github-project-php
A PHP package for managing GitHub projects with Laravel
Fund package maintenance!
tanhongit
Requires
- php: ^8.3
- knplabs/github-api: ^3.16
- nyholm/psr7: ^1.8
- symfony/http-client: ^7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.0
- nunomaduro/collision: ^7.10
- nunomaduro/larastan: ^2.9
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
README
📝 Introduction
GitHub Project PHP is a package that helps you manage your Github projects in PHP.
It provides a simple and easy-to-use webhooks system to get the GitHub project's actions and implement comments on all activities in the project.
Available Field Type Templates
Standard Field Types
- text - For simple text fields
- number - For numeric fields
- date - For date fields (formatted as Y-m-d)
- single_select - For single-select dropdowns with color support
- multi_select - For multi-select fields
- checkbox - For boolean/toggle fields
- textarea - For long text content with diff view
- iteration - For iteration/sprint fields
- labels - For label/tag fields
- assignees - For user assignment fields
- milestone - For milestone tracking
- unsupported - Fallback for unknown field types
📋 Requirements
🔧 Installation
You can install this package via Composer:
composer require cslant/github-project-php
Customizing Templates
You can publish and customize the templates by running:
php artisan vendor:publish --tag=github-project-views
This will copy the templates to resources/views/vendor/github-project/md/field_types/
where you can modify them.
🚀 Usage
See the Usage - GitHub Project PHP Documentation for a list of usage.
Please check and update some configurations in the documentation.
Template Variables
All field type templates receive the following variables:
$fieldName
- The display name of the field$fieldType
- The type of the field (e.g., 'text', 'number')$fromValue
- The previous value of the field$toValue
- The new value of the field$fieldData
- Raw field data from the webhook
Adding Custom Field Types
To add support for a custom field type:
- Create a new template file in the
field_types
directory - Name it with your field type (e.g.,
custom_type.blade.php
) - The template will automatically be used when a field of that type is encountered
Styling
GitHub Flavored Markdown (GFM) is supported. You can use:
**bold**
for bold text*italic*
for italic text`code`
for inline codecode blocks
for multi-line code- links for URLs
- HTML is also supported for more complex formatting
Best Practices
- Keep messages concise but informative
- Use consistent formatting
- Include relevant context
- Handle null/empty values gracefully
- Use emoji sparingly for visual cues
Example Custom Template
Here's an example of a custom field type template:
@if($fromValue != null && $toValue != null) **`{{ $fieldName }}`** changed from **`{{ $fromValue }}`** to **`{{ $toValue }}`** @elseif($toValue) **`{{ $fieldName }}`** set to **`{{ $toValue }}`** @else **`{{ $fieldName }}`** cleared @endif
📖 Official Documentation
Please see the GitHub Project PHP Documentation for more information.
License
The MIT License (MIT). Please see License File for more information.