Skip to content

Commit dcbfe2d

Browse files
committed
Customize package
1 parent 5429fbe commit dcbfe2d

9 files changed

+84
-235
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BASE_PATH=./
22
BUILD_ROOT_PATH=/app/
3-
PROJECT_NAME=me_library
3+
PROJECT_NAME=wp-oop_http-client
44

55
PHP_BUILD_VERSION=7.4
66
PHP_TEST_VERSION=8.2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
/.idea/codeStyles/
55
/.idea/inspectionProfiles/
66
/.idea/misc.xml
7+
/.idea/phpspec.xml
8+
/.idea/codeception.xml
79
/.env
810

911
/.phpunit.result.cache

.idea/php-project.iml renamed to .idea/http-client.iml

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,3 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [[*next-version*]] - YYYY-MM-DD
8-
9-
## [0.1.2-alpha1] - 2023-03-10
10-
### Fixed
11-
- Maintenance: update tool configs, modernize Docker.
12-
13-
## [0.1.1-alpha2] - 2021-06-21
14-
### Fixed
15-
- Composer complaining about locally modified dependencies in pristine environment on initial build (#6).
16-
17-
## [0.1.1-alpha1] - 2021-06-10
18-
### Added
19-
- PHPStorm configuration for PHPCS and Psalm via Docker (#3).
20-
21-
## [0.1.0] - 2021-06-10
22-
Stable release
23-
24-
## [0.1.0-alpha1] - 2021-03-09
25-
Initial version.

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020 Dhii
1+
Copyright 2020 WP-OOP
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
44
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
@@ -12,4 +12,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1212
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1313
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1414
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
15-
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 8 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,10 @@
1-
# Dhii - PHP Project
2-
[![Continuous Integration](https://github.com/dhii/php-project/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/dhii/php-project/actions/workflows/continuous-integration.yml)
1+
# WP HTTP Client
2+
[![Continuous Integration](https://img.shields.io/github/actions/workflow/status/wp-oop/http-client/continuous-integration.yml?logo=github&logoColor=FFFFFF)](https://github.com/wp-oop/http-client/actions/workflows/continuous-integration.yml)
3+
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/wp-oop/http-client)][packagist]
4+
[![Latest Stable Version](https://poser.pugx.org/wp-oop/http-client/v)][packagist]
5+
[![Latest Unstable Version](https://poser.pugx.org/wp-oop/http-client/v/unstable)][packagist]
36

4-
A PHP starter to ease project creation
7+
A PSR-18 wrapper for the [WordPress HTTP API][wp-http-api].
58

6-
## Details
7-
Use this project as a starter for your PHP library!
8-
9-
### Feaures
10-
- **Docker** - Develop and test your plugin with Docker. Use an environment
11-
tailored for your plugin. See changes instantly in the browser. Build
12-
a Docker image containing a complete WordPress installation with your
13-
plugin and all pre-requisites.
14-
15-
- **PHPStorm** - Configuration for integrations of arguably the best PHP
16-
IDE out there, including:
17-
18-
* **Composer** - Install and manage PHP dependencies on the correct version of PHP without leaving the IDE.
19-
* **PHPUnit** - Run tests and get reports directly in PHPStorm.
20-
* **xDebug** - Set breakpoints and inspect your code in PHPStorm.
21-
* **Code coverage** - See what has not been tested yet in a friendly GUI.
22-
23-
- **Static Code Analysis** - Maintain a consistent coding style, and catch problems early.
24-
25-
* **[Psalm][]** - Inspects your code for problems.
26-
* **[PHPCS][]** - Checks your code style. [PHPCBF][] can fix some of them automatically.
27-
28-
- **Continuous Integration** - Automatically verify that all contributions comply with
29-
project standards with [GitHub Actions][].
30-
31-
### Usage
32-
33-
#### Getting Started
34-
Use Composer to bootstrap your project.
35-
36-
1. Clone and install deps:
37-
38-
```bash
39-
composer create-project dhii/php-project my_project
40-
```
41-
42-
Here, `my_project` is the name of the project folder.
43-
44-
2. Customize project
45-
46-
_Note_: Asterisk `*` below denotes that changing this value requires rebuild of the images in order
47-
to have effect on the dev environment.
48-
49-
- Copy `.env.example` to `.env`.
50-
- `.env`:
51-
* `BASE_PATH` - If you are using [Docker Machine][], i.e. on any non-Linux system, set this
52-
to the absolute path to the project folder _inside the machine_. If you are on Linux,
53-
you do not need to change this.
54-
* `PROJECT_NAME` - Slug of your project. Used mainly for naming containers with [`container_name`][].
55-
This is helpful to run multiple projects on the same machine.
56-
* `PHP_BUILD_VERSION` - The version of PHP, on which the plugin will be _built_. This should
57-
correspond to the minimal PHP requirement of your plugin. Used to determine the tag of
58-
the [`php`][] image.
59-
* `PHP_TEST_VERSION`* - The version of PHP, on which the plugin will be _run_. This should
60-
correspond to the maximal PHP requirement of your plugin. Used to determine the tag of
61-
the [`php`][] image.
62-
63-
- `composer.json`:
64-
* `name` - Name of your package.
65-
* `description` - Description of your package.
66-
* `authors` - You and/or your company details.
67-
* `require` - Your project's package and platform requirements. You may want to change the PHP
68-
version if your minimal requirement is different. Don't forget to update `PHP_BUILD_VERSION`
69-
in `.env`.
70-
* `require-dev` - Your project's development requirements. Tools for testing and code quality.
71-
72-
#### Updating Dependencies
73-
Composer is installed into the `build` service's image. To run composer commands,
74-
use `docker-compose run`. For example, to update dependencies you can run the following:
75-
76-
```bash
77-
docker-compose run --rm build composer update
78-
```
79-
80-
If you use PHPStorm, you can use the [composer integration][], as the project
81-
is already configured for this.
82-
83-
#### Testing Code
84-
This bootstrap includes PHPUnit. It is already configured, and you can test
85-
that it's working by running the sample tests:
86-
87-
```bash
88-
docker-compose run --rm test vendor/bin/phpunit
89-
```
90-
91-
If you use PHPStorm, you can use its PHPUnit integration: right-click on any
92-
test or folder inside the `tests` directory, and choose "Run". This will do
93-
the same as the above command. Because the `test` service is used for tests,
94-
they will be run with its PHP version, which should correspond to your project's
95-
minimal requirements, but can be something else if you want to test on a system
96-
that has different specs.
97-
98-
#### Debugging
99-
The bootstrap includes xDebug in the `test` service of the Docker environment,
100-
and PHPStorm configuration. To use it, right click on any test or folder within
101-
the `tests` directory, and choose "Debug". This will run the tests with xDebug
102-
enabled. If you receive the error about [`xdebug.remote_host`][] being set
103-
incorrectly and suggesting to fix the error, fix it by setting that variable
104-
to [your machine's IP address][] on the local network in the window that
105-
pops up. After this, breakpoints in any code reachable by PHPUnit tests,
106-
including the code of tests themselves, will cause execution to pause,
107-
allowing inspection of code.
108-
109-
#### Static Analysis
110-
- **Psalm**
111-
112-
Run Psalm in project root:
113-
114-
```bash
115-
docker-compose run --rm test vendor/bin/psalm
116-
```
117-
118-
* Will also be run automatically on CI.
119-
* PHPStorm integration config included.
120-
121-
- **PHPCS**
122-
123-
Run PHPCS/PHPCBF in project root:
124-
125-
```bash
126-
docker-compose run --rm test vendor/bin/phpcs -s --report-source --runtime-set ignore_warnings_on_exit 1
127-
docker-compose run --rm test vendor/bin/phpcbf
128-
```
129-
130-
* By default, uses [PSR-12][] and some rules from the [Slevomat Coding Standard][].
131-
* Will also be run automatically on CI.
132-
* PHPStorm integration config included.
133-
134-
135-
[Docker Machine]: https://github.com/docker/machine
136-
[PSR-12]: https://www.php-fig.org/psr/psr-12/
137-
[Slevomat Coding Standard]: https://github.com/slevomat/coding-standard
138-
[Psalm]: https://psalm.dev/
139-
[PHPCS]: https://github.com/squizlabs/PHP_CodeSniffer
140-
[PHPCBF]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically
141-
[GitHub Actions]: https://github.com/features/actions
142-
[hosts file]: https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/
143-
[your machine's IP address]: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address
144-
[composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies
145-
[`container_name`]: https://docs.docker.com/compose/compose-file/#container_name
146-
[`php`]: https://hub.docker.com/_/php
147-
[`docker-machine start`]: https://docs.docker.com/machine/reference/start/]
148-
[`docker-machine env`]: https://docs.docker.com/machine/reference/env/
149-
[`xdebug.remote_host`]: https://xdebug.org/docs/all_settings#remote_host
9+
[packagist]: https://packagist.org/packages/wp-oop/http-client
10+
[wp-http-api]: https://developer.wordpress.org/plugins/http-api/

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "dhii/php-project",
3-
"description": "A PHP starter to ease project creation",
2+
"name": "wp-oop/http-client",
3+
"description": "A PSR-18 wrapper for the WordPress HTTP API",
44
"minimum-stability": "dev",
55
"license": "MIT",
66
"authors": [
@@ -21,12 +21,12 @@
2121
},
2222
"autoload": {
2323
"psr-4": {
24-
"Me\\Library\\": "src"
24+
"WpOop\\HttpClient\\": "src"
2525
}
2626
},
2727
"autoload-dev": {
2828
"psr-4": {
29-
"Me\\Library\\Test\\Func\\": "tests/functional"
29+
"WpOop\\HttpClient\\Test\\Func\\": "tests/functional"
3030
}
3131
},
3232
"config": {

0 commit comments

Comments
 (0)