Commit Graph

113 Commits

Author SHA1 Message Date
David
2a8313bb68
Check PHP API version in build script (#11)
Ensure that the user is compiling with a supported version
of PHP.
2021-03-11 12:34:47 +13:00
David
8f108a61c3
Returning from functions (#9)
* Added ability to set value of zval

This allows the return value to now be set.
See the example in `example/skel/src.lib`.

* Added PHP internals book to resources

* Pass self as pointer to keep consistency
2021-03-11 01:06:58 +13:00
David
0dd1a3f80f
Added argument overloading (#8)
* Added argument overloading

If a double is requested but a long is available, we can cast the
long into a double. This is required if the user gives an integer
into a double field.

As well as this, if a string is requested but a long or double is
available, we can cast both of these into a string.

* Check if zval is present before setting in arg

* Added optional argument example

* Updated documentation for ZendLong

* WIP: added null checks
2021-03-10 21:09:18 +13:00
David
9fbe186098
Added argument parsing for functions (#6)
* Moved not required argument logic into function

Seemed more logical, as you can't have a required argument after the
not required argument. Usage:

```rs
FunctionBuilder::new("skeleton_version", skeleton_version)
    .arg(Arg::new("req_arg1", DataType::String))
    .arg(Arg::new("req_arg1", DataType::String))
    .not_required()
    .arg(Arg::new("not_req_arg1", DataType::String))
    .build()
```

* Added zend_value implementation

Helper functions to retrieve the value from zvals

* Started work on argument parser

* Added PHP version support notice

Due to the way the Zend API changes and the fact that the
stable interface is exposed via C macros, there is no
support for versions lower than PHP 8.0. In the future
we can support PHP 7.4 through Rust features.

* Added TryFrom implementations for Zval -> Types

* Added ability to select arguments from ExecutionData

* Added ability to parse arguments and retrieve val

See `example/skel/src/lib.rs` for usage.
2021-03-10 19:50:44 +13:00
David
52f9d40050
Added support for functions (#1)
* started work on functions

can now add functions, but can't return from them

* arg defaults to required
2021-03-10 11:43:17 +13:00
David Cole
0211148a1a hide public c functions from docs (wrapped by macros) 2021-03-09 21:02:56 +13:00
David Cole
3ce64f2d66 hide internal macro from docs 2021-03-09 21:01:43 +13:00
David Cole
59b694a4bd added type alias docs 2021-03-09 21:01:07 +13:00
David Cole
d964164ca7 added contributing clause 2021-03-09 20:58:07 +13:00
David Cole
a7d542735f added readme, license, updated cargo.toml 2021-03-09 20:56:14 +13:00
David Cole
7587dccd0d added module builder, example project, documentation 2021-03-09 20:47:20 +13:00
David Cole
50d774ee31 added info table headers
infotable class is deprecated
2021-03-09 16:28:37 +13:00
David Cole
61ed3c8a15 initial commit
added php wrapper
2021-03-09 12:40:12 +13:00