|
1 | | -# github-project-php 👋 |
| 1 | +# GitHub Project PHP |
2 | 2 |
|
3 | 3 | <p align="center"> |
4 | 4 | <a href="#"><img src="https://img.shields.io/github/license/cslant/github-project-php.svg?style=flat-square" alt="License"></a> |
5 | 5 | <a href="https://github.com/cslant/github-project-php/releases"><img src="https://img.shields.io/github/release/cslant/github-project-php.svg?style=flat-square" alt="Latest Version"></a> |
6 | 6 | <a href="https://packagist.org/packages/cslant/github-project-php"><img src="https://img.shields.io/packagist/dt/cslant/github-project-php.svg?style=flat-square" alt="Total Downloads"></a> |
7 | 7 | <a href="https://github.com/cslant/github-project-php/actions/workflows/setup_test.yml"><img src="https://img.shields.io/github/actions/workflow/status/cslant/github-project-php/setup_test.yml?label=tests&branch=main" alt="Test Status"></a> |
8 | 8 | <a href="https://github.com/cslant/github-project-php/actions/workflows/php-cs-fixer.yml"><img src="https://img.shields.io/github/actions/workflow/status/cslant/github-project-php/php-cs-fixer.yml?label=code%20style&branch=main" alt="Code Style Status"></a> |
| 9 | +</p> |
9 | 10 |
|
10 | | -## 📝 Introduction |
| 11 | +## Introduction |
11 | 12 |
|
12 | | -GitHub Project PHP is a package that helps you manage your Github projects in PHP. |
| 13 | +GitHub Project PHP is a Laravel package that helps you manage your GitHub Projects (V2) in PHP. |
13 | 14 |
|
14 | | -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. |
| 15 | +It provides a simple webhook system to receive GitHub project events and automatically generate activity comments on issues and pull requests. |
15 | 16 |
|
16 | | -## Available Field Type Templates |
17 | | - |
18 | | -### Standard Field Types |
| 17 | +## Features |
19 | 18 |
|
20 | | -1. **text** - For simple text fields |
21 | | -2. **number** - For numeric fields |
22 | | -3. **date** - For date fields (formatted as Y-m-d) |
23 | | -4. **single_select** - For single-select dropdowns with color support |
24 | | -5. **multi_select** - For multi-select fields |
25 | | -6. **checkbox** - For boolean/toggle fields |
26 | | -7. **textarea** - For long text content with diff view |
27 | | -8. **iteration** - For iteration/sprint fields |
28 | | -9. **labels** - For label/tag fields |
29 | | -10. **assignees** - For user assignment fields |
30 | | -11. **milestone** - For milestone tracking |
31 | | -12. **unsupported** - Fallback for unknown field types |
| 19 | +- **Webhook Integration**: Receive and process GitHub Projects V2 webhook events |
| 20 | +- **Queue Support**: Process webhook events asynchronously for better performance |
| 21 | +- **API Endpoint**: Generate comment messages via REST API |
| 22 | +- **12+ Field Type Templates**: Built-in templates for all GitHub Project field types |
| 23 | +- **Customizable Templates**: Publish and customize Blade templates |
| 24 | +- **GitHub GraphQL API**: Direct integration with GitHub's GraphQL API |
32 | 25 |
|
33 | | -## 📋 Requirements |
| 26 | +## Requirements |
34 | 27 |
|
35 | | -- PHP ^8.3 |
| 28 | +- PHP ^8.4 |
| 29 | +- Laravel ^11.0|^12.0 |
36 | 30 | - [Composer](https://getcomposer.org/) |
37 | | -- [Laravel](https://laravel.com/) ^10.0 |
38 | 31 |
|
39 | | -## 🔧 Installation |
40 | | - |
41 | | -You can install this package via Composer: |
| 32 | +## Installation |
42 | 33 |
|
43 | 34 | ```bash |
44 | 35 | composer require cslant/github-project-php |
45 | 36 | ``` |
46 | 37 |
|
47 | | -### Customizing Templates |
| 38 | +## Available Field Type Templates |
| 39 | + |
| 40 | +| Field Type | Description | |
| 41 | +|-----------------|--------------------------------------------| |
| 42 | +| `text` | Simple text fields | |
| 43 | +| `number` | Numeric fields | |
| 44 | +| `date` | Date fields (Y-m-d format) | |
| 45 | +| `single_select` | Single-select dropdowns with color support | |
| 46 | +| `multi_select` | Multi-select fields | |
| 47 | +| `checkbox` | Boolean/toggle fields | |
| 48 | +| `textarea` | Long text content with diff view | |
| 49 | +| `iteration` | Iteration/sprint fields | |
| 50 | +| `labels` | Label/tag fields | |
| 51 | +| `assignees` | User assignment fields | |
| 52 | +| `milestone` | Milestone tracking | |
| 53 | +| `unsupported` | Fallback for unknown field types | |
| 54 | + |
| 55 | +## Usage |
| 56 | + |
| 57 | +See the [GitHub Project PHP Documentation](https://docs.cslant.com/github-project-php/usage) for detailed usage instructions. |
48 | 58 |
|
49 | | -You can publish and customize the templates by running: |
| 59 | +### Customizing Templates |
50 | 60 |
|
51 | 61 | ```bash |
52 | 62 | php artisan vendor:publish --tag=github-project-views |
53 | 63 | ``` |
54 | 64 |
|
55 | | -This will copy the templates to `resources/views/vendor/github-project/md/field_types/` where you can modify them. |
56 | | - |
57 | | -## 🚀 Usage |
58 | | - |
59 | | -See the [Usage - GitHub Project PHP Documentation](https://docs.cslant.com/github-project-php/usage) |
60 | | -for a list of usage. |
61 | | - |
62 | | -Please check and update some configurations in the documentation. |
| 65 | +This copies templates to `resources/views/vendor/github-project/md/field_types/`. |
63 | 66 |
|
64 | 67 | ### Template Variables |
65 | 68 |
|
66 | | -All field type templates receive the following variables: |
67 | | - |
68 | | -- `$fieldName` - The display name of the field |
69 | | -- `$fieldType` - The type of the field (e.g., 'text', 'number') |
70 | | -- `$fromValue` - The previous value of the field |
71 | | -- `$toValue` - The new value of the field |
72 | | -- `$fieldData` - Raw field data from the webhook |
73 | | - |
74 | | -### Adding Custom Field Types |
| 69 | +All field type templates receive: |
75 | 70 |
|
76 | | -To add support for a custom field type: |
| 71 | +- `$fieldName` - Display name of the field |
| 72 | +- `$fieldType` - Type of the field |
| 73 | +- `$fromValue` - Previous value |
| 74 | +- `$toValue` - New value |
| 75 | +- `$fieldData` - Raw webhook data |
77 | 76 |
|
78 | | -1. Create a new template file in the `field_types` directory |
79 | | -2. Name it with your field type (e.g., `custom_type.blade.php`) |
80 | | -3. The template will automatically be used when a field of that type is encountered |
| 77 | +### API Endpoint |
81 | 78 |
|
82 | | -### Styling |
| 79 | +Generate comment messages via API: |
83 | 80 |
|
84 | | -GitHub Flavored Markdown (GFM) is supported. You can use: |
| 81 | +``` |
| 82 | +POST /github-project/generate-comment |
| 83 | +Content-Type: application/json |
85 | 84 |
|
86 | | -- `**bold**` for bold text |
87 | | -- `*italic*` for italic text |
88 | | -- `` `code` `` for inline code |
89 | | -- ```code blocks``` for multi-line code |
90 | | -- [links](https://example.com) for URLs |
91 | | -- HTML is also supported for more complex formatting |
| 85 | +{ |
| 86 | + "payload": { ... } |
| 87 | +} |
| 88 | +``` |
92 | 89 |
|
93 | | -### Best Practices |
| 90 | +### Queue Configuration |
94 | 91 |
|
95 | | -1. Keep messages concise but informative |
96 | | -2. Use consistent formatting |
97 | | -3. Include relevant context |
98 | | -4. Handle null/empty values gracefully |
99 | | -5. Use emoji sparingly for visual cues |
| 92 | +Enable queue processing in your config: |
100 | 93 |
|
101 | | -### Example Custom Template |
| 94 | +```php |
| 95 | +// config/github-project.php |
| 96 | +'is_queue_enabled' => true, |
| 97 | +``` |
102 | 98 |
|
103 | | -Here's an example of a custom field type template: |
| 99 | +## Documentation |
104 | 100 |
|
105 | | -```blade |
106 | | -@if($fromValue != null && $toValue != null) |
107 | | - **`{{ $fieldName }}`** changed from **`{{ $fromValue }}`** to **`{{ $toValue }}`** |
108 | | -@elseif($toValue) |
109 | | - **`{{ $fieldName }}`** set to **`{{ $toValue }}`** |
110 | | -@else |
111 | | - **`{{ $fieldName }}`** cleared |
112 | | -@endif |
113 | | -``` |
| 101 | +Full documentation available at [docs.cslant.com/github-project-php](https://docs.cslant.com/github-project-php) |
114 | 102 |
|
115 | | -## 📖 Official Documentation |
| 103 | +## Changelog |
116 | 104 |
|
117 | | -Please see the [GitHub Project PHP Documentation](https://docs.cslant.com/github-project-php) for more |
118 | | -information. |
| 105 | +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
119 | 106 |
|
120 | 107 | ## License |
121 | 108 |
|
|
0 commit comments