Skip to content

Commit 3846a92

Browse files
getsolarisgetsolaris
authored andcommitted
docs: added suggest email
1 parent d3cc8b9 commit 3846a92

File tree

7 files changed

+59
-24
lines changed

7 files changed

+59
-24
lines changed

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55
</p>
66

77
# A MVCS pattern create a service command for Laravel 5+
8-
Create a new service class and service contract
8+
Create a new service class and service interface
99

1010
# Install
1111
```bash
1212
composer require getsolaris/laravel-make-service
1313
```
1414

15+
# Suggest
16+
17+
18+
1519
# Usage
1620
```bash
17-
$ php artisan make:service {name : Create a service class} {--c : Optional of create a service contract}
21+
$ php artisan make:service {name : Create a service class} {--i : Optional of create a service interface}
1822
```
1923

2024
# Example
@@ -40,22 +44,28 @@ class UserService
4044
}
4145
```
4246

43-
## + Optional service contract
47+
## + Optional service interface
48+
49+
```
50+
v1.0.x -> contract
51+
v1.1.x -> interface
52+
```
53+
4454
```bash
45-
$ php artisan make:service UserService --c
55+
$ php artisan make:service UserService --i
4656
```
4757

4858
```php
4959
<?php
50-
// app/Http/Services/Contracts/UserServiceContract.php
60+
// app/Http/Services/Contracts/UserServiceInterface.php
5161

52-
namespace App\Services\Contracts;
62+
namespace App\Services\Interfaces;
5363

5464
/**
55-
* Interface UserServiceContract
56-
* @package App\Services\Contracts
65+
* Interface UserServiceInterface
66+
* @package App\Services\Interfaces
5767
*/
58-
interface UserServiceContract
68+
interface UserServiceInterface
5969
{
6070

6171
}
File renamed without changes.

src/Stubs/service.interface.stub

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use {{ namespace }}\Contracts\{{ class }}Contract;
6+
7+
/**
8+
* Class {{ class }}
9+
* @package App\Services
10+
*/
11+
class {{ class }} implements {{ class }}Contract
12+
{
13+
14+
}

src/Stubs/service.origin.stub

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Stubs/service.stub

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace {{ namespace }};
44

5-
use {{ namespace }}\Contracts\{{ class }}Contract;
6-
75
/**
86
* Class {{ class }}
97
* @package App\Services
108
*/
11-
class {{ class }} implements {{ class }}Contract
9+
class {{ class }}
1210
{
1311

1412
}

tests/GenerateTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class MakeFileExistTest extends TestCase
6+
{
7+
public function test_console_command(): void
8+
{
9+
$this->artisan('make:service');
10+
}
11+
}

tests/StubExistTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class MakeTest extends TestCase
6+
{
7+
public function test_exist_service_stub(): void
8+
{
9+
$this->assertFileExists(
10+
'service.stub',
11+
"given filename doesn't exists"
12+
);
13+
}
14+
}

0 commit comments

Comments
 (0)