WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package is primarily maintained by the community. External contributions are always welcome. If you need assistance, feel free to [open an issue](https://github.com/prismicio-community/php-kit/issues/new/choose) or request a review by opening a pull request.
4
+
5
+
## Setup
6
+
7
+
To get started working on this project, you’ll need the following set up on your local machine:
8
+
9
+
- PHP 8.0+
10
+
- Composer 2.0+
11
+
- The [APCu](https://www.php.net/manual/en/ref.apcu.php) extension for PHP
12
+
13
+
Clone this GitHub repository, then run the following command to install all dependencies:
14
+
15
+
```bash
16
+
$ composer install
17
+
```
18
+
19
+
## Project-specific Notes
20
+
21
+
Some of the SDK’s tests require APCu (Alternative PHP Cache) to function correctly from the command line. If you have APC installed and enabled, but cache-related tests still fail, please try the following:
22
+
23
+
-**Verify APC is enabled for CLI:** Run `php -i | grep apc` to check if APC is active for the command line. If no output appears, APC may be enabled only for the web server (e.g., Apache) and not for CLI. Consult your OS documentation to enable APC for CLI. If it involves modifying a `php.ini` file, ensure you're editing the correct one, as there may be separate `php.ini` files for the web server and CLI.
24
+
25
+
-**Enable the `apc.enable_cli` setting:** If APC is enabled for CLI but tests still fail, verify that `apc.enable_cli` is set to ‘On’ in the output of `php -i | grep apc`. If it isn’t, add `apc.enable_cli = 1` at the end of the appropriate `php.ini` file. Again, confirm you are editing the correct `php.ini` file for CLI, not the one used by Apache.
26
+
27
+
## Develop
28
+
29
+
Once your environment is set up, you can start developing new features or fixing bugs. Please ensure that you follow the coding standards and conventions in the existing codebase.
30
+
31
+
Before starting on a large change, it’s recommended that you open an issue to discuss your proposed changes. This allows you to receive early feedback and helps determine the best way to proceed.
32
+
33
+
If you want to test your changes in an example you can either create a new file in the `samples` directory or modify an existing one (locally). In case you want to test the changes in a real project, you can link your local package to the project using [Composer](https://getcomposer.org/doc/05-repositories.md#path).
34
+
35
+
In any case please make sure to write test cases for your changes.
|`composer test`| This command will run the test suite with PHPUnit (requires the APCu extension). |
42
+
|`composer cs-check`| This command will check the code style with PHP CS Fixer. |
43
+
44
+
## Tests
45
+
46
+
Please ensure that you write tests for any new features or bug fixes you implement.
47
+
48
+
If you find existing code that could benefit from additional testing, we appreciate contributions to improve test coverage. In such cases, please create a dedicated branch and submit a separate pull request to document and review your testing improvements.
49
+
50
+
You can run the tests with the following command:
51
+
52
+
```bash
53
+
$ ./vendor/bin/phpunit
54
+
```
55
+
56
+
## Submit a pull request
57
+
58
+
When you are ready to submit your changes, push your branch to the repository and open a pull request. Please include a detailed description of your changes and any relevant information for reviewers.
59
+
60
+
Your pull request will be reviewed by a maintainer. If changes are requested, please make them on your branch and push the updates to the repository. The pull request will be updated automatically.
61
+
62
+
## Publish
63
+
64
+
Publishing a new version of the package is restricted to maintainers.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
3
+
Licensed under the Apache License, Version 2.0 (the "License");
4
+
you may not use this file except in compliance with the License.
5
+
You may obtain a copy of the License at
4
6
5
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
7
+
http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+
Unless required by applicable law or agreed to in writing, software
10
+
distributed under the License is distributed on an "AS IS" BASIS,
11
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+
See the License for the specific language governing permissions and
This is the official PHP SDK for Prismic.io, providing a straightforward way to connect to Prismic’s headless API. It is maintained by the community to help developers get started with Prismic in PHP.
4
9
5
-
## Getting started
10
+
- Offers an easy-to-use interface for basic interactions with Prismic content
We recommend installing and enabeling the [APCu](https://www.php.net/manual/en/ref.apcu.php) extension to have the built-in default cache support. Otherwise, you can implement your own cache strategy by extending the `Prismic\Cache\CacheInterface` interface.
18
37
19
-
Include the dependency:
38
+
### Basic Usage & API calls
39
+
40
+
If you are not using automatic autoloading, include the Composer autoload file:
The PHP SDK provides a set of DOM helpers to help you render your Prismic content.
39
59
40
-
In these examples we have a $doc variable corresponding to the fetched Prismic document.
41
-
We also have a $linkResolver variable containing the functional link resolver, [read our docs to learn more about Link Resolving](https://prismic.io/docs/php/beyond-the-api/link-resolving).
60
+
In these examples we have a document variable corresponding to the fetched Prismic document. We also have a $linkResolver variable containing the functional link resolver, [read our docs to learn more about Link Resolving](https://prismic.io/docs/php/beyond-the-api/link-resolving).
Clone this GitHub repository, then [install Composer](https://getcomposer.org/doc/00-intro.md) if you haven't, and run:
99
+
Whether you're helping us fix bugs, improve the docs, or spread the word, we'd love to have you as part of the Prismic developer community!
82
100
83
-
```bash
84
-
$ composer install
85
-
```
101
+
**Reporting a bug**: [Open an issue][repo-bug-report] explaining your application's setup and the bug you're encountering.
86
102
87
-
## Tests
103
+
**Suggesting an improvement**: [Open an issue][repo-feature-request] explaining your improvement or feature so we can discuss and learn more.
88
104
89
-
Please write tests for any bugfix or new feature.
105
+
**Submitting code changes**: For small fixes, feel free to [open a pull request][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented.
90
106
91
-
If you find existing code that is not optimally tested and wish to make it better, we really appreciate it; but you should document it on its own branch and its own pull request.
107
+
For more clarity on this project, check out the detailed [CONTRIBUTING.md](./CONTRIBUTING.md) for our guidelines.
92
108
93
-
Tests are run by running the command:
109
+
## License
94
110
95
-
```bash
96
-
$ ./vendor/bin/phpunit
97
-
```
111
+
This software is licensed under the [Apache 2 License](https://opensource.org/license/apache-2-0), quoted below:
98
112
99
-
Some of the kit's tests check stuff that are built on top of APC and need APC to work from the command line. If you've installed and enabled APC, and your cache tests don't pass:
- check if your APC is enabled for your command line, by running `php -i | grep apc`; if no output is displayed, then maybe the APC extension you installed and enabled is only enabled in apache but not for your command line. Check how your OS works to make that happen, and if it involves changing a php.ini file, make sure it's the right php.ini (you might have one for apache, and one for the command line)
102
-
- if APC is enabled for the command line, and yet the tests still fail, make sure your `apc.enable_cli` (which you see in the output of `php -i | grep apc`) is 'On'. If it's not, add this at the end of your php.ini: `apc.enable_cli = 1`. Make sure it's the right php.ini (you might have one for apache, and one for the command line)
116
+
Licensed under the Apache License, Version 2.0 (the "License");
117
+
you may not use this file except in compliance with the License.
118
+
You may obtain a copy of the License at
103
119
104
-
## License
120
+
http://www.apache.org/licenses/LICENSE-2.0
105
121
106
-
This software is licensed under the Apache 2 license, quoted below.
122
+
Unless required by applicable law or agreed to in writing, software
123
+
distributed under the License is distributed on an "AS IS" BASIS,
124
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125
+
See the License for the specific language governing permissions and
126
+
limitations under the License.
127
+
```
107
128
108
-
Copyright 2018 Prismic (https://prismic.io).
129
+
<!-- Links -->
109
130
110
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0 commit comments