php

package
v0.0.0-...-dae269f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PHP

type PHP struct {
	ingredient.Base
	Dependencies struct {
		Barrel *barrel.Barrel
	}
}

func (*PHP) EvalCode

func (php *PHP) EvalCode(ctx context.Context, server *phpx.Server, value any, code string) (err error)

func (*PHP) ExecScript

func (php *PHP) ExecScript(ctx context.Context, server *phpx.Server, value any, code string, entrypoint string, args ...any) (err error)

ExecScript executes the PHP code as a script on the given server. When server is nil, creates a new server and automatically closes it after execution. Calling this function repeatedly with server = nil is inefficient.

The script should define a function called entrypoint, and may define additional functions.

Code must start with "<?php" and may not contain a closing tag. Code is expected not to mess with PHPs output buffer. Code should not contain user input. Code breaking these conventions may or may not result in an error.

It's arguments are encoded as json using [json.Marshal] and decoded within php.

The return value of the function is again marshaled with json and returned to the caller.

func (*PHP) NewServer

func (php *PHP) NewServer() *phpx.Server

NewServer returns a new server that can execute code within this distillery. When err == nil, the caller must call server.Close().

See [PHPServer].

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL