Skip to content

Commit 32c6512

Browse files
committed
Update README
1 parent af6f68b commit 32c6512

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

README.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22

33
This project provides a PHP extension implementing bindings for [`libgit2`](https://github.com/libgit2/libgit2). You can use this library to build native Git tooling directly into your PHP application.
44

5-
This branch targets PHP 8. See other branches for other PHP major versions. Please note that this project no longer supports versions before PHP 7.
6-
7-
> Note: At this time, PHP 8 support is experimental.
5+
This branch targets PHP 8. See other branches for other PHP major versions. Please note that this project no longer supports versions before PHP 8.
86

97
Primary author:
108

119
> [Roger Gee](https://github.com/RogerGee)
1210
1311
## Versioning
1412

15-
Since we do not bundle the `libgit2` dependency, it's up to the user to provide the correct version of `libgit2` when building the extension. The `libgit2` version corresponds indirectly to the version of `php-git2` being built. Consult the following table to determine the correct version of `libgit2` required by `php-git2`:
13+
Since we do not bundle the `libgit2` dependency, it's up to the user to provide the correct version of `libgit2` when building (and running) the extension. The `libgit2` version corresponds indirectly to the version of `php-git2` being built. Consult the following table to determine the correct version of `libgit2` required by `php-git2`:
1614

1715
| `php-git2` | `libgit2` | Notes |
1816
| -------- | ------- | ------- |
19-
| `2.0.0` | `^1.5.0` | `libgit2` API is now stable |
20-
| `1.0.0` | `0.25.1` | `libgit2` is unstable, so `v1` exclusively uses `0.25.1` |
17+
| **`2.0.0`** | `^1.5.0` | `libgit2` API is now stable |
18+
| `1.0.0` | `0.25.1` | `libgit2` is unstable, so `php-git2@^1.0.0` exclusively uses `0.25.1` |
2119

2220
The entries in the table above denote the `libgit2` version requirement for a particular `php-git2` release. An entry is only added when a new version of `libgit2` is required.
2321

24-
In theory, you should be able to use any version that fits the constraint (and possibly some previous `libgit2` releases within the same major version). The minimum `libgit2` version denoted by the constraint is the one we use to develop and test the release.
22+
In theory, you should be able to use any version that fits the constraint. The minimum `libgit2` version denoted by the constraint is the one we use to develop and test the corresponding release.
23+
24+
The `php-git2` version corresponds directly to the interfaces and bindings implemented by the extension. Semantic versioning is employed to allow an application to target a correct constraint in its `composer.json` file.
2525

2626
### Branches
2727

@@ -43,11 +43,12 @@ Our core design principle is to follow the original, `libgit2` C API as closely
4343

4444
- Most of the opaque `libgit2` data types (i.e. handles) are implemented as resources in PHP userspace:
4545
- This allows the PHP API to closely follow the underlying C API.
46+
- (Note that in the next major version of this project, we plan to convert all resources to opaque classes. [This seems to be the trend](https://php.watch/articles/resource-object) in other PHP extensions, and it may be that resource types will be deprecated/removed in future versions of PHP.)
4647
- Functions that return a `libgit2` handle via an output parameter in the C API return a resource via the function return value in the PHP API:
4748
- (e.g. `git_repository_open()` returns a `git_repository` resource).
4849
- Errors are always converted into PHP exceptions
49-
- Custom interface data structures (e.g. backends) are implemented as PHP classes:
50-
- This allows the developer to implement a subclass that easily implements a custom interface.
50+
- Custom data structures (e.g. backends) are implemented as PHP classes:
51+
- This allows the developer to write a subclass that easily implements a custom data structure.
5152
- For example, the `git_odb_backend` structure is a class called `GitODBBackend`.
5253
- A developer could subclass `GitODBBackend` to provide an alternate storage mechanism for a repository's object database (such as a MySQL or SQLite database)
5354
- Most other data structures are implemented using arrays
@@ -71,7 +72,7 @@ The extension will keep the `git_repository` object alive behind the scenes sinc
7172

7273
### Programming methodology
7374

74-
Most of the extension is designed as inline code in header files. We use C++ metaprogramming constructs to generate extension functions. This approach is great for streamlining redundant tasks, separating the prototype for a binding from its implementation and keeping track of API changes. However, it comes with the small drawback of decreased flexibility when implementing unusual or more custom bindings.
75+
Most of the extension is designed as inline code in header files. (A header file is provided for each major section of the `libgit2` API, such as `git_repository`.) We use C++ metaprogramming constructs to generate extension functions. This approach is great for streamlining redundant tasks, separating the prototype for a binding from its implementation and keeping track of API changes. However, it comes with the small drawback of decreased flexibility when implementing unusual or more custom bindings.
7576

7677
If a binding doesn't "fit the mold" and cannot be implemented using one of the generic binding template function generators, then we recommend the binding be written directly in the header file using the conventional `PHP_FUNCTION` macro.
7778

@@ -142,6 +143,7 @@ This project does not officially support Windows at this time. With this said, t
142143
| -- | -- |
143144
| Improve unit testing | Complete (October 2022) |
144145
| Update to `libgit2` version 1 | Complete (January 2023) |
145-
| Add support for PHP 8 | In progress |
146+
| Add support for PHP 8 | Complete (September 2023) |
146147
| Add support for custom `libgit2` memory allocator utilizing PHP's memory allocation functionality | Pending |
147148
| Create phpdoc files to generate documentation site | Pending |
149+
| Convert resource types to opaque object types | Pending |

0 commit comments

Comments
 (0)