Download the PHP package xiifactors/azure-functions-bundle without Composer

On this page you can find all versions of the php package xiifactors/azure-functions-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package azure-functions-bundle

Prereqs

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

Step 3: Import the routes

Then, import the routes by adding the following in the config/routes.yaml file of your project:

Step 4: Import the services

Then, import the routes by adding the following in the config/services.yaml file of your project:

Step 5: Copy over required files

This repo includes example host.json and local.settings.json files (suffixed with .example), as well as a bash script (run.sh) that has a one-liner to execute the PHP webserver with the correct env vars.

Run the following in a terminal from the root of your project:

Step 6: Create the Azure Function HTTP Entrypoint

In the root of the project create a directory named HttpEntrypoint.

Inside this directory create a function.json file with the following contents:

Step 7: Create your first controller

You must use the ResponseDto to help with formatting the response:

Step 8: Start the function

Run the following in your terminal:

You should now be able to run the following curl request locally:

and receive:

enableForwardingHttpRequest

This is a flag set in the host.json file for the custom handler. Our host.json.example has it enabled by default.

If this flag is false it mean that the Azure Function host will send a POST request to the URI /{NameOfFunction} (e.g. /HttpEntrypoint) including all details of the original request (like URI, method, params, etc) in the body. In this instance it is the job of HttpEntrypointController to process that request and then send an internal request to the desired route.

But if the flag is set to true, it means that the function host will simply forward the original request onto our application. This bundle includes a ConvertResponseListener (which will be enabled when you import the services - described in Step 4.) that will seamlessly handle both scenarios.

NOTE: When the flag is true it will improve performance, but be aware that the forwarding will only happen if the function is defined with an HTTP trigger "in" binding, and an HTTP "out" binding. If there are any additional bindings the request will not be forwarded and the behaviour reverts to that as if the flag is false - See the official documentation.

Output Bindings

The following example shows a function that receives an HTTP request and then uses an output binding to write a message to a queue. In this example you need to set the Outputs property of the ResponseDto object.

Note: This will mean that enableForwardingHttpRequest will be nullified even if it is set to true, as we have defined an extra binding.

The function.json:

The controller:

Input Bindings

If you are only dealing with HTTP then you will just create controllers like the HealthController above.

If you need to deal with other types of input, then it will be similar but note that the function host will POST to the name of the function, and the details of the input will be included in the request body. You can use the RequestDto to map the request data if you want.

The function.json:

The controller:

Deploying the function to Azure

There is more than one way to deploy the PHP function, the method offered here is to create a Docker image and then update the function app to use that image instead of its default one.

1. Create the Dockerfile:

2. Build and push the image to your ACR (Azure Container Registry)

3. Add any necessary environment variables to the function app

4. Deploy the new image

Within a couple of minutes the image should have been updated and new function deployed.


All versions of azure-functions-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-ctype Version *
ext-iconv Version *
phpdocumentor/reflection-docblock Version ^5.3
phpstan/phpdoc-parser Version ^1.23
symfony/console Version 6.3.*
symfony/dotenv Version 6.3.*
symfony/flex Version ^2
symfony/framework-bundle Version 6.3.*
symfony/property-access Version 6.3.*
symfony/property-info Version 6.3.*
symfony/runtime Version 6.3.*
symfony/serializer Version 6.3.*
symfony/twig-bundle Version 6.3.*
symfony/validator Version 6.3.*
symfony/yaml Version 6.3.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xiifactors/azure-functions-bundle contains the following files

Loading the files please wait ....