Skip to content

Commit

Permalink
Update README.md with expanded details
Browse files Browse the repository at this point in the history
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
koriym committed Jun 26, 2024
1 parent 0b1737a commit 0f7a9da
Showing 1 changed file with 67 additions and 11 deletions.
78 changes: 67 additions & 11 deletions README.md
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
```

0 comments on commit 0f7a9da

Please sign in to comment.