Skip to content

Commit 5f2cea7

Browse files
committed
added contributing md and fix readme
1 parent f6aebb2 commit 5f2cea7

File tree

2 files changed

+115
-29
lines changed

2 files changed

+115
-29
lines changed

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# How to contribute to laravel-makeclass
2+
3+
Hey, thank you for contributing. Here are some tips to make it easy for you.
4+
5+
## Committing code
6+
7+
1. Fork the project
8+
1. `git clone` it and `composer install` the dependencies
9+
1. Create a new branch
10+
1. Think about how the changes you are about to make can be tested, optionally write tests before coding
11+
1. Run tests, make sure they fail
12+
1. Write the actual code to make the tests pass
13+
1. Open a pull request detailing your changes. Make sure to follow the [template](.github/PULL_REQUEST_TEMPLATE.md)
14+
15+
## Testing
16+
17+
I use **PHPUnit** for testing.
18+
19+
Have a new feature? You can start off by writing some tests that detail
20+
the behaviour you want to achieve and go from there.
21+
22+
Fixing a bug? The best way to ensure it is fixed for good and never comes
23+
back is to write a failing test for it and then make it pass. If you can
24+
not figure out how to fix it yourself, feel free to submit a PR with a
25+
failing test.
26+
27+
Run the testsuite
28+
29+
```bash
30+
composer test
31+
```
32+
33+
## Codestyle
34+
35+
Formatting is automated through [php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer).
36+
37+
Check the codestyle
38+
39+
```bash
40+
composer check-style
41+
```
42+
43+
Apply automated fixes
44+
45+
```bash
46+
composer fix-style
47+
```

README.md

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,86 @@
1-
# How to contribute to laravel-makeclass
1+
#Laravel Make Class
2+
### Features
23

3-
Hey, thank you for contributing. Here are some tips to make it easy for you.
4+
- Create a php class from the command for any directory in the root name-space;
5+
- Store a custom path as an alias and use alias instead of full path.
6+
- Create interface | class | enum | trait.
7+
- Create final and abstract classes
8+
- Create class with a declare strict_type
49

5-
## Committing code
6-
7-
1. Fork the project
8-
1. `git clone` it and `composer install` the dependencies
9-
1. Create a new branch
10-
1. Think about how the changes you are about to make can be tested, optionally write tests before coding
11-
1. Run tests, make sure they fail
12-
1. Write the actual code to make the tests pass
13-
1. Open a pull request detailing your changes. Make sure to follow the [template](.github/PULL_REQUEST_TEMPLATE.md)
10+
### Installation
11+
```bash
12+
composer require opheus2/laravel-makeclass
13+
```
1414

15-
## Testing
15+
###Usages
16+
> File is created in root name-space. E.b App
17+
```bash
18+
php artisan make:class {name}
19+
```
20+
Default type is class.
1621

17-
I use **PHPUnit** for testing.
22+
------------
1823

19-
Have a new feature? You can start off by writing some tests that detail
20-
the behaviour you want to achieve and go from there.
24+
> File is created in test folder in root name-space. E.b App/Test
25+
```bash
26+
php artisan make:class Test\{name}
27+
```
28+
------------
29+
> Create an interface type of class
30+
```bash
31+
php artisan make:class {name} -i
32+
or
33+
php artisan make:class {name} --type interface
34+
```
35+
------------
2136

22-
Fixing a bug? The best way to ensure it is fixed for good and never comes
23-
back is to write a failing test for it and then make it pass. If you can
24-
not figure out how to fix it yourself, feel free to submit a PR with a
25-
failing test.
37+
| Available types | flags|
38+
| ------------ |
39+
| class | (default no flag) |
40+
| interface | (-i or --interface) |
41+
| trait | (-T or --trait) |
42+
| enum | (-e or --enum) |
2643

27-
Run the testsuite
44+
------------
45+
> Using custom path with alias
46+
```bash
47+
php artisan make:class {name} -i -p="Domains/Services/" --alias="ape"
48+
or
49+
php artisan make:class {name} -i -p=Domain\Services\ --alias=ape
50+
or
51+
php artisan make:class {name} -i -p Domain\Services\ --alias ape
52+
```
53+
**Please note:** You always need to add a trailing slash at the end for it to work properly.
54+
I would surely fix that soon.
2855

56+
Then you can use alias as path
2957
```bash
30-
composer test
58+
php artisan make:class {name} -i -p="ape"
3159
```
60+
This would use the same old/saved path for subsquent file names
3261

33-
## Codestyle
62+
------------
63+
> Using modifiers
64+
```bash
65+
php artisan make:class {name} -fx
66+
```
67+
This would creat a final class with declare strict_types at the top
68+
You can use the -x flag to always add the strict type to any class type
3469

35-
Formatting is automated through [php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer).
70+
------------
3671

37-
Check the codestyle
72+
| Available modfiers | flags|
73+
| ------------ |
74+
| strict | (-x or --strict) |
75+
| final | (-f or --final) |
76+
| abstract | (-a or --abstract) |
3877

78+
For more info you can do
3979
```bash
40-
composer check-style
80+
php artisan make:class --help
4181
```
4282

43-
Apply automated fixes
83+
####Thank you
4484

45-
```bash
46-
composer fix-style
47-
```
85+
###TODO
86+
- [ ] Add check for trailing slash and auto fix

0 commit comments

Comments
 (0)