Skip to content

Commit 9ad3b4c

Browse files
committed
feature: Create GPT Helper for Laravel
0 parents  commit 9ad3b4c

13 files changed

+7721
-0
lines changed

.env.example

Whitespace-only changes.

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
vendor
3+
.env

LICENSE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Clara Leigh
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# GPT Helper for Laravel
2+
3+
This package provides seamless integration of GPT (ChatGPT) with Laravel, allowing you to generate templates and modify files using ChatGPT. With the powerful GPT models and Laravel's artisan commands, you can easily customize and enhance your Laravel application.
4+
5+
## Installation
6+
7+
You can install the package via composer:
8+
9+
```bash
10+
composer require ClaraLeigh/gpt-helper-for-laravel
11+
```
12+
The package will automatically register itself.
13+
14+
## Configuration
15+
16+
You can publish the config file with:
17+
18+
```bash
19+
php artisan vendor:publish --provider="GptHelperForLaravel\Console\GptTemplatesServiceProvider" --tag="config"
20+
```
21+
22+
This will create a gpt-helper.php config file in your config directory. You can set your ChatGPT API key, model, GPT settings, and Domain-Driven Design starting directory in the configuration file.
23+
24+
## Publish Language Files
25+
26+
You can publish the language files with:
27+
28+
```bash
29+
php artisan vendor:publish --provider="GptHelperForLaravel\Console\GptTemplatesServiceProvider" --tag="lang"
30+
```
31+
32+
This will create a resources/lang/vendor/gpt-helper directory, where you can store your language files.
33+
34+
## Usage
35+
36+
Use the GPT Helper for Laravel in your existing artisan commands or create custom commands that leverage the ChatGPT API. Remember to pass the --prompt option to the commands to modify the file contents using ChatGPT.
37+
38+
For example, in your custom command:
39+
40+
```bash
41+
php artisan make:model Books --prompt="This is a books model, with authors, genre's, publication dates and a relevant library"
42+
```
43+
44+
This will create a Books model in your app directory, and the contents of the file will be modified using ChatGPT.
45+
46+
## Available Templates
47+
48+
The following templates are available:
49+
50+
- Model
51+
- Controller
52+
- Request
53+
- Resource
54+
- Migration
55+
- Factory
56+
- Seeder
57+
58+
## Available Settings
59+
60+
The following GPT settings are available:
61+
62+
- model
63+
- max_tokens
64+
- temperature
65+
- n
66+
- stop
67+
68+
## Testing
69+
70+
``` bash
71+
composer test
72+
```
73+
74+
## License
75+
76+
I am considering changing this license, open a issue if you have any suggestions.
77+
78+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
79+
80+
## Credits
81+
82+
- [ClaraLeigh](https://github.com/ClaraLeigh)

composer.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "claraleigh/gpt-helper-for-laravel",
3+
"description": "A Laravel package that generates templates using ChatGPT",
4+
"type": "library",
5+
"keywords": ["laravel", "gpt", "templates"],
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Clara Leigh"
10+
}
11+
],
12+
"require": {
13+
"php": "^8.0",
14+
"illuminate/support": "^9.0|^10.0",
15+
"illuminate/filesystem": "^9.0|^10.0",
16+
"illuminate/translation": "^9.0|^10.0",
17+
"openai-php/laravel": "^0.4.0",
18+
"symfony/console": "^6.2",
19+
"guzzlehttp/guzzle": "^7.0.1"
20+
},
21+
"require-dev": {
22+
"phpunit/phpunit": "^9.3.10"
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"GptHelperForLaravel\\": "src/"
27+
}
28+
},
29+
"extra": {
30+
"laravel": {
31+
"providers": [
32+
"GptHelperForLaravel\\GptServiceProvider"
33+
]
34+
}
35+
},
36+
"config": {
37+
"preferred-install": "dist",
38+
"sort-packages": true,
39+
"optimize-autoloader": true
40+
},
41+
"minimum-stability": "dev",
42+
"prefer-stable": true
43+
}

0 commit comments

Comments
 (0)