Skip to content

Commit f2064c7

Browse files
committed
docs(readme): Update the readme and rename the CLI
1 parent 85a65e8 commit f2064c7

File tree

5 files changed

+127
-42
lines changed

5 files changed

+127
-42
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Contributions are **welcome** and will be fully **credited**.
44

5-
We accept contributions via Pull Requests on [Github](https://github.com/php-prefixer/php-prefixer-rest-api-cli).
5+
We accept contributions via Pull Requests on [Github](https://github.com/php-prefixer/php-prefixer-cli).
66

77
## Pull Requests
88

README.md

Lines changed: 111 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,140 @@
1-
# PHP Prefixer REST API CLI
1+
# PHP Prefixer CLI
22

33
![PHP-Prefixer](https://php-prefixer.com/images/logo/php-prefixer-144x144.png)
44

5-
A REST client for the PHP-Prefixer service.
6-
75
[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs)
86

9-
## Run Locally
7+
A command-line for the [PHP-Prefixer](https://php-prefixer.com) service. The command calls the **PHP-Prefixer** service using the [REST API](https://php-prefixer.com/docs/rest-api-reference/) to submit a project source code, apply the prefixes, wait and download the results.
108

11-
Clone the project
9+
**PHP-Prefixer** is a cloud service to apply PHP prefixes to namespaces, functions, helpers, traits, interfaces, etc. Start with a Composer project and a set of dependencies, and prefix all library files at once to generate a consistent prefixed codebase.
1210

13-
```bash
14-
git clone https://github.com/php-prefixer/php-prefixer-rest-api-cli
15-
```
11+
Given this sample class declaration:
1612

17-
Go to the project directory
13+
```php
14+
namespace ACME\Carbon;
1815

19-
```bash
20-
cd php-prefixer-rest-api-cli
16+
use ACME\Carbon\Exceptions\InvalidDateException;
17+
use DateInterval;
18+
use ACME\Symfony\Component\Translation;
19+
20+
class Carbon extends DateTime
21+
{
22+
const NO_ZERO_DIFF = 01;
23+
...
2124
```
2225

23-
Install dependencies
26+
The associated prefixed class declaration, with a new and distinct namespace `ACME`:
2427

25-
```bash
26-
composer update
28+
```php
29+
namespace ACME\Carbon;
30+
31+
use ACME\Carbon\Exceptions\InvalidDateException;
32+
use DateInterval;
33+
use ACME\Symfony\Component\Translation;
34+
35+
class Carbon extends DateTime
36+
{
37+
const NO_ZERO_DIFF = 01;
38+
...
2739
```
2840

29-
Run the prefixer service
41+
## Installation
42+
43+
### PHAR
44+
45+
The preferred installation method is with the PHP Prefixer CLI PHAR. You can download the latest PHAR from the most recent [Github Releases](https://github.com/PHP-Prefixer/php-prefixer-cli/releases).
46+
47+
### Composer
48+
49+
You can install PHP-Prefixer CLI globally with Composer:
50+
51+
´´´sh
52+
composer global require php-prefixer/php-prefixer-cli
53+
´´´
54+
55+
## Usage
56+
57+
To use the command line, you must create an account on [PHP-Prefixer](https://php-prefixer.com/), and prepare your projects with the prefix definition in the `composer.json` schema.
58+
59+
Before using the command line, we recommend checking the documentation and guides here: <https://php-prefixer.com/docs/>
60+
61+
The command line requires four parameters, and it can receive an additional parameter:
62+
63+
Parameter | Description
64+
---------|----------
65+
source-directory * | The project source directory.
66+
target-directory *| The target directory where the results are stored.
67+
personal-access-token* | The personal access token, generated on [PHP-Prefixer](https://php-prefixer.com/)/ Settings.
68+
project-id * | The identification of the configured project on [PHP-Prefixer](https://php-prefixer.com/)/ Projects.
69+
--github-access-token | An optional GitHub token to access ´composer.json´ dependencies that are managed in private repositories.
3070

3171
```bash
32-
./php-prefixer-rest-api-cli prefix ./tests/Mock/Source ./tests/Mock/Target \
33-
$PHP_PREFIXER_PERSONAL_ACCESS_TOKEN \
34-
aaa \
35-
--github-access-token=$PHP_PREFIXER_GH_TOKEN
72+
# Sample command line
73+
php-prefixer-cli prefix \
74+
# Source Directory
75+
/sample/acme_project \
76+
# Target Directory
77+
/sample/prefixed_project \
78+
# Personal Access Token
79+
789|Qkfuf79mLwXBCoEhpxLl12DJbeqUJKs03ZFAq2Nd \
80+
# Project ID
81+
123456 \
82+
# GitHub Access Token
83+
--github-access-token=95c889f375458a9b33988af375458a3387ba6
3684
```
3785

38-
## Environment Variables
86+
### Environment Variables
3987

40-
To run this project, you will need to add the following environment variables to your .env file
88+
The command line supports the definition of the parameters as environment variables in a `.env` file in a project
4189

42-
`API_KEY`
90+
```yml
91+
# Sample .env
4392

44-
`ANOTHER_API_KEY`
93+
# Source Directory
94+
SOURCE_DIRECTORY="/sample/acme_project"
4595

96+
# Target Directory
97+
TARGET_DIRECTORY="/sample/prefixed_project"
98+
99+
# Personal Access Token
100+
PERSONAL_ACCESS_TOKEN="789|Qkfuf79mLwXBCoEhpxLl12DJbeqUJKs03ZFAq2Nd"
101+
102+
# Project ID
103+
PROJECT_ID="123456"
104+
105+
# GitHub Access Token
106+
GITHUB_ACCESS_TOKEN="95c889f375458a9b33988af375458a3387ba6"
107+
```
46108

47109
## Documentation
48110

49111
- [PHP-Prefixer Documentation](https://php-prefixer.com/docs)
50-
- [REST API Referece](https://php-prefixer.com/docs/api-documentation/)
112+
- [PHP Prefixer CLI](https://php-prefixer.com/docs/command-line)
113+
- [REST API Referece](https://php-prefixer.com/docs/rest-api-reference/)
114+
115+
## Command Line Development
116+
117+
Clone the project
118+
119+
```bash
120+
git clone https://github.com/php-prefixer/php-prefixer-cli
121+
```
122+
123+
Go to the project directory
124+
125+
```bash
126+
cd php-prefixer-cli
127+
```
128+
129+
Install dependencies
130+
131+
```bash
132+
composer update
133+
```
51134

52-
## Running Tests
135+
### Running Tests
53136

54-
To run tests, run the following command
137+
To run tests, run the following command:
55138

56139
```bash
57140
phpunit
@@ -61,11 +144,11 @@ phpunit
61144

62145
Contributions are always welcome!
63146

64-
See `contributing.md` for ways to get started.
147+
See `CONTRIBUTING.md` for ways to get started.
65148

66149
## Security
67150

68-
If you discover a security vulnerability within this package, please send an email to Graham Campbell at team@php-prefixer.com. All security vulnerabilities will be promptly addressed.
151+
If you discover a security vulnerability within this package, please send an email to Anibal Sanchez at team@php-prefixer.com. All security vulnerabilities will be promptly addressed.
69152

70153
## License
71154

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "php-prefixer/php-prefixer-rest-api-cli",
3-
"description": "A REST client for the PHP-Prefixer service.",
4-
"keywords": ["php-prefixer", "php", "prefixer", "service", "rest", "cli"],
2+
"name": "php-prefixer/php-prefixer-cli",
3+
"description": "A command-line for the PHP-Prefixer service.",
4+
"keywords": ["php-prefixer", "php", "prefixer", "service", "rest", "cli", "functions", "namespace", "prefix", "namespaces-php"],
55
"homepage": "http://php-prefixer.com/",
66
"type": "project",
77
"license": "MIT",
88
"support": {
9-
"issues": "https://github.com/php-prefixer/php-prefixer-rest-api-cli/issues",
10-
"source": "https://github.com/php-prefixer/php-prefixer-rest-api-cli"
9+
"issues": "https://github.com/php-prefixer/php-prefixer-cli/issues",
10+
"source": "https://github.com/php-prefixer/php-prefixer-cli"
1111
},
1212
"authors": [
1313
{

env.example

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
# Sample .env
12

3+
# Source Directory
24
SOURCE_DIRECTORY="..."
5+
6+
# Target Directory
37
TARGET_DIRECTORY="..."
8+
9+
# Personal Access Token
410
PERSONAL_ACCESS_TOKEN="..."
5-
PROJECT_ID="..."
6-
GITHUB_ACCESS_TOKEN="..."
711

8-
# Only for testing
9-
INVALID_PERSONAL_ACCESS_TOKEN="..."
10-
INVALID_GITHUB_ACCESS_TOKEN="..."
11-
TEST_BUILD_ID="..."
12-
BROKEN_COMPOSER_SOURCE_DIRECTORY="..."
13-
BROKEN_DEPS_SOURCE_DIRECTORY="..."
12+
# Project ID
13+
PROJECT_ID="..."
1414

15+
# GitHub Access Token
16+
GITHUB_ACCESS_TOKEN="..."
File renamed without changes.

0 commit comments

Comments
 (0)