-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README.md with expanded details
The README.md file has been significantly expanded to include detailed instructions on using the HelloWorld PHP Extension. It now explains the basic 'helloworld()' function, the advanced 'helloworld_advanced()' function, along with instructions on building and running the extension. Additional script usage details have also been provided.
- Loading branch information
Showing
1 changed file
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,73 @@ | ||
# ext-helloworld | ||
# HelloWorld PHP Extension | ||
|
||
## Install | ||
[![Build and Test PHP Extension](https://github.com/koriym/ext-helloworld/actions/workflows/build.yml/badge.svg)](https://github.com/koriym/ext-helloworld/actions/workflows/build.yml) | ||
|
||
```sh | ||
# git clean -fd | ||
# phpize --clean | ||
phpize | ||
./configure | ||
make | ||
``` | ||
A simple PHP extension that demonstrates basic and advanced "Hello World" functionality. | ||
|
||
## Features | ||
|
||
- Basic `helloworld()` function | ||
- Advanced `helloworld_advanced()` function with configurable greeting | ||
|
||
## Run | ||
|
||
```sh | ||
php -dextension=helloworld.so helloworld.php | ||
1. Compile the extension: | ||
|
||
``` | ||
// make clean | ||
// phpize --clean | ||
phpize | ||
./configure --enable-helloworld-advanced | ||
make | ||
``` | ||
2. Run | ||
``` | ||
% php -d extension=./modules/helloworld.so -i | grep hello | ||
helloworld | ||
helloworld support => enabled | ||
helloworld.greeting => Hello World! => Hello World! | ||
% php -d extension=./modules/helloworld.so php/helloworld.php | ||
Hello World! | ||
Hello World! | ||
``` | ||
|
||
## Usage | ||
|
||
### Basic Function | ||
|
||
```php | ||
<?php | ||
helloworld(); | ||
// Output: Hello World! | ||
``` | ||
|
||
### Advanced Function | ||
|
||
```php | ||
<?php | ||
helloworld_advanced(); | ||
// Output: [Configurable greeting from php.ini] | ||
|
||
``` | ||
|
||
To configure the greeting, add the following to your php.ini: | ||
|
||
``` | ||
helloworld.greeting = "Your custom greeting!" | ||
``` | ||
|
||
## Build script | ||
|
||
You can use the build.sh script for various build operations: | ||
|
||
```sh | ||
./build.sh clean # Clean the build environment | ||
./build.sh prepare # Prepare the build environment | ||
./build.sh build # Build the extension | ||
./build.sh run # Run the extension | ||
./build.sh all # Execute all the above steps | ||
``` |