@@ -13,6 +13,23 @@ GitHub Project PHP is a package that helps you manage your Github projects in PH
1313
1414It 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.
1515
16+ ## Available Field Type Templates
17+
18+ ### Standard Field Types
19+
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
32+
1633## 📋 Requirements
1734
1835- PHP ^8.3
@@ -27,13 +44,74 @@ You can install this package via Composer:
2744composer require cslant/github-project-php
2845```
2946
47+ ### Customizing Templates
48+
49+ You can publish and customize the templates by running:
50+
51+ ``` bash
52+ php artisan vendor:publish --tag=github-project-views
53+ ```
54+
55+ This will copy the templates to ` resources/views/vendor/github-project/md/field_types/ ` where you can modify them.
56+
3057## 🚀 Usage
3158
3259See the [ Usage - GitHub Project PHP Documentation] ( https://docs.cslant.com/github-project-php/usage )
3360for a list of usage.
3461
3562Please check and update some configurations in the documentation.
3663
64+ ### Template Variables
65+
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
75+
76+ To add support for a custom field type:
77+
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
81+
82+ ### Styling
83+
84+ GitHub Flavored Markdown (GFM) is supported. You can use:
85+
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
92+
93+ ### Best Practices
94+
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
100+
101+ ### Example Custom Template
102+
103+ Here's an example of a custom field type template:
104+
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+ ```
114+
37115## 📖 Official Documentation
38116
39117Please see the [ GitHub Project PHP Documentation] ( https://docs.cslant.com/github-project-php ) for more
0 commit comments