Skip to content

Commit d819d1f

Browse files
committed
package setup
0 parents  commit d819d1f

File tree

7 files changed

+212
-0
lines changed

7 files changed

+212
-0
lines changed

.github/FUNDING.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [bhargavraviya]
4+
patreon: raviyatechnical
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

LICENSE

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

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<br />
2+
<div align="center">
3+
<img src="https://www.rajtechnologies.com/ui/images/raj-technologies-logo-top-panel.jpg" alt="Logo" width=120>
4+
<h1 align="center">Laravel Helper Generator</h1>
5+
6+
<p align="center">
7+
Quickly generate helper for your projects!
8+
</p>
9+
<br><br>
10+
</div>
11+
12+
## Table of Contents
13+
<ol>
14+
<li><a href="#installation">Installation</a></li>
15+
<li>
16+
<a href="#usage">Usage</a>
17+
</li>
18+
<li><a href="#more-generator-packages">More generator packages</a></li>
19+
<li><a href="#contributing">Contributing</a></li>
20+
<li><a href="#license">License</a></li>
21+
</ol>
22+
23+
## Installation
24+
Install the package with composer.
25+
```bash
26+
composer require raviyatechnical/laravel-helper-generator
27+
```
28+
29+
## Usage
30+
Run the following command on the command-line to generate a new action.
31+
```
32+
php artisan make:helper {name}
33+
```
34+
35+
## Contributing
36+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
37+
38+
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
39+
Don't forget to give the project a star! Thanks again!
40+
41+
1. Fork the Project
42+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
43+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
44+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
45+
5. Open a Pull Request
46+
47+
## License
48+
49+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "raviyatechnical/laravel-helper-generator",
3+
"description": "Generate Laravel Helper",
4+
"keywords": [
5+
"generator",
6+
"php",
7+
"cli",
8+
"laravel",
9+
"artisan",
10+
"helper",
11+
"pattern"
12+
],
13+
"type": "library",
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Bhargav Raviya",
18+
"email": "raviyatechnical@gmail.com"
19+
}
20+
],
21+
"autoload": {
22+
"psr-4": {
23+
"RaviyaTechnical\\HelperGenerator\\": "src/"
24+
}
25+
},
26+
"minimum-stability": "dev",
27+
"extra": {
28+
"laravel": {
29+
"providers": [
30+
"RaviyaTechnical\\HelperGenerator\\HelperGeneratorServiceProvider"
31+
]
32+
}
33+
}
34+
}

src/Console/MakeHelper.php

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace RaviyaTechnical\HelperGenerator\Console;
4+
5+
use Illuminate\Console\GeneratorCommand;
6+
7+
class MakeHelper extends GeneratorCommand
8+
{
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected $signature = 'make:helper {name}';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Create a new helper class';
22+
23+
/**
24+
* The type of class being generated.
25+
*
26+
* @var string
27+
*/
28+
protected $type = 'Helper';
29+
30+
/**
31+
* Get the stub file for the generator.
32+
*
33+
* @return string
34+
*/
35+
protected function getStub()
36+
{
37+
return __DIR__.'/../../stubs/helper.stub';
38+
}
39+
40+
/**
41+
* Get the default namespace for the class.
42+
*
43+
* @param string $rootNamespace
44+
* @return string
45+
*/
46+
protected function getDefaultNamespace($rootNamespace)
47+
{
48+
return $rootNamespace.'\Helpers';
49+
}
50+
}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace RaviyaTechnical\HelperGenerator;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
use RaviyaTechnical\HelperGenerator\Console\MakeHelper;
7+
8+
class HelperGeneratorServiceProvider extends ServiceProvider
9+
{
10+
public function register()
11+
{
12+
$this->loadHelpers();
13+
}
14+
15+
public function boot()
16+
{
17+
if ($this->app->runningInConsole()) {
18+
$this->commands([MakeHelper::class]);
19+
}
20+
}
21+
22+
protected function loadHelpers()
23+
{
24+
foreach (glob(app_path().'/Helpers/*.php') as $filename)
25+
{
26+
require_once $filename;
27+
}
28+
// foreach (glob(__DIR__.'/../Helpers/*.php') as $filename)
29+
// {
30+
// require_once $filename;
31+
// }
32+
}
33+
}

stubs/helper.stub

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/*
4+
if (!function_exists('log_error')) {
5+
function log_error($exception, $dump = true)
6+
{
7+
if (config('app.env') == 'local' && $dump) {
8+
dd($exception);
9+
}
10+
Log::error($exception);
11+
}
12+
}
13+
*/

0 commit comments

Comments
 (0)