{"id":19289837,"url":"https://github.com/brefphp/extra-php-extensions","last_synced_at":"2026-03-11T13:23:54.039Z","repository":{"id":37390479,"uuid":"229222956","full_name":"brefphp/extra-php-extensions","owner":"brefphp","description":"Community-maintained extra PHP extensions usable in AWS Lambda with the Bref PHP runtimes.","archived":false,"fork":false,"pushed_at":"2024-05-01T05:56:46.000Z","size":1249,"stargazers_count":204,"open_issues_count":25,"forks_count":111,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-01T23:05:38.420Z","etag":null,"topics":["aws-lambda","bref","lambda","lambda-layer","lambda-layers"],"latest_commit_sha":null,"homepage":"https://bref.sh/docs/environment/php.html#extra-extensions","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brefphp.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Nyholm","mnapoli"],"custom":"https://bref.sh/#enterprise"}},"created_at":"2019-12-20T08:28:20.000Z","updated_at":"2024-08-26T10:00:20.888Z","dependencies_parsed_at":"2024-05-03T07:04:03.234Z","dependency_job_id":null,"html_url":"https://github.com/brefphp/extra-php-extensions","commit_stats":{"total_commits":354,"total_committers":65,"mean_commits":5.446153846153846,"dds":0.5988700564971752,"last_synced_commit":"8b2f80a435b2310aac739effd01b087955c483a1"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brefphp%2Fextra-php-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brefphp%2Fextra-php-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brefphp%2Fextra-php-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brefphp%2Fextra-php-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brefphp","download_url":"https://codeload.github.com/brefphp/extra-php-extensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240395740,"owners_count":19794573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","bref","lambda","lambda-layer","lambda-layers"],"created_at":"2024-11-09T22:17:19.675Z","updated_at":"2026-03-11T13:23:54.025Z","avatar_url":"https://github.com/brefphp.png","language":"Dockerfile","funding_links":["https://github.com/sponsors/Nyholm","https://github.com/sponsors/mnapoli","https://bref.sh/#enterprise"],"categories":[],"sub_categories":[],"readme":"# Bref Extra PHP Extension\n\nThis repository provides PHP extensions for [Bref](https://bref.sh/) applications via AWS Lambda layers.\n\nThis is useful when you want something \"off the shelf\".\nIf you ever need more than 2-3 layer you should consider creating your own layer. That is because AWS has\na limit of 5 layers per Lambda. You can also utilise the provided docker images for local development.\n\n\u003e **Note**\n\u003e\n\u003e If you are using Bref v3, you need to use version `3.x` of the `bref/extra-php-extensions` package.\n\u003e\n\u003e There is no version `2.x` of the `bref/extra-php-extensions` package.\n\u003e\n\u003e If you are using Bref v2, you need to use version `1.x` of the `bref/extra-php-extensions` package.\n\n\n\u003e **Warning**\n\u003e\n\u003e **ARM64 is not supported with extra extensions.**\n\n\nWe are happy to get contributions for other extensions. Sky is the limit! (And also your knowledge with Docker...)\n\n## Install and configure\n\n```cli\ncomposer require bref/extra-php-extensions\n```\n\n```yaml\n# serverless.yml\nservice: app\n\nprovider:\n    name: aws\n    region: us-east-1\n\nplugins:\n    - ./vendor/bref/bref\n    - ./vendor/bref/extra-php-extensions # \u003c----- Add the extra Serverless plugin\n\nfunctions:\n    console:\n        handler: bin/console\n        runtime: php-81\n        layers:\n            - ${bref-extra:amqp-php-83} # \u003c----- Example for AMQP layer\n```\n\n### Available layers\n\n| Name             | Serverless config (php 8.1)            |\n|:-----------------|:---------------------------------------|\n| AMQP             | `${bref-extra:amqp-php-81}`            |\n| Blackfire        | `${bref-extra:blackfire-php-81}`       |\n| Bsdiff           | `${bref-extra:bsdiff-php-81}`          |\n| Calendar         | `${bref-extra:calendar-php-81}`        |\n| Cassandra        | `${bref-extra:cassandra-php-81}`       |\n| Datadog          | `${bref-extra:datadog-php-81}`         |\n| Decimal          | `${bref-extra:decimal-php-81}`         |\n| DS               | `${bref-extra:ds-php-81}`              |\n| Elastic APM      | `${bref-extra:elastic-apm-php-81}`     |\n| Excimer          | `${bref-extra:excimer-php-81}`         |\n| GD               | `${bref-extra:gd-php-81}`              |\n| gnupg            | `${bref-extra:gnupg-php-81}`           |\n| GMP              | `${bref-extra:gmp-php-81}`             |\n| gRPC             | `${bref-extra:grpc-php-81}`            |\n| h3               | `${bref-extra:h3-php-81}`              |\n| Igbinary         | `${bref-extra:igbinary-php-81}`        |\n| Imagick          | `${bref-extra:imagick-php-81}`         |\n| IMAP             | `${bref-extra:imap-php-81}`            |\n| LDAP             | `${bref-extra:ldap-php-81}`            |\n| Mailparse        | `${bref-extra:mailparse-php-81}`       |\n| MaxMind DB       | `${bref-extra:maxminddb-php-81}`       |\n| Memcache         | `${bref-extra:memcache-php-81}`        |\n| Memcached        | `${bref-extra:memcached-php-81}`       |\n| MongoDB v1.x     | `${bref-extra:mongodb-php-81`          |\n| MongoDB v2.x     | `${bref-extra:mongodb2-php-81}`        |\n| MsgPack          | `${bref-extra:msgpack-php-81}`         |\n| Newrelic         | `${bref-extra:newrelic-php-81}`        |\n| ODBC Snowflake   | `${bref-extra:odbc-snowflake-php-81}`  |\n| OpenSwoole       | `${bref-extra:openswoole-php-81}`      |\n| OpenTelemetry    | `${bref-extra:opentelemetry-php-81}`   |\n| Oracle           | `${bref-extra:oci8-php-83}`            |\n| Pcov             | `${bref-extra:pcov-php-81}`            |\n| PostgreSQL       | `${bref-extra:pgsql-php-81}`           |\n| RdKafka          | `${bref-extra:rdkafka-php-81}`         |\n| Redis (phpredis) | `${bref-extra:redis-php-81}`           |\n| Redis-Igbinary   | `${bref-extra:redis-igbinary-php-81}`  |\n| Relay            | `${bref-extra:relay-php-81}`           |\n| Scout APM        | `${bref-extra:scoutapm-php-81}`        |\n| Scrypt           | `${bref-extra:scrypt-php-81}`          |\n| SNMP             | `${bref-extra:snmp-php-81}`            |\n| SPX              | `${bref-extra:spx-php-81}`             |\n| SSH2             | `${bref-extra:ssh2-php-81}`            |\n| Swoole           | `${bref-extra:swoole-php-81}`          |\n| Symfony Runtime  | `${bref-extra:symfony-runtime-php-81}` |\n| Microsoft SQLSRV | `${bref-extra:sqlsrv-php-81}`          |\n| Tideways         | `${bref-extra:tideways-php-81}`        |\n| Tidy             | `${bref-extra:tidy-php-81}`            |\n| UUID             | `${bref-extra:uuid-php-81}`            |\n| Xdebug           | `${bref-extra:xdebug-php-81}`          |\n| Xlswriter        | `${bref-extra:xlswriter-php-81}`       |\n| xmlrpc           | `${bref-extra:xmlrpc-php-81}`          |\n| Yaml             | `${bref-extra:yaml-php-81}`            |\n\n### Blackfire installation\n\nThe Blackfire layer only have the probe installed.\n\nYou still need to install the agent.\nThe agent is installed on a separate server (not a lambda function). The micro\nEC2 instance is sufficient to run the Blackfire agent.\n\nCreate a `blackfire.ini` file in `php/conf.d/` for your lambda function where you load the extension\nand modify the `agent_socket` in order to point it to the Blackfire Agent.\n\n```ini\n;php/conf.d/blackfire.ini\nblackfire.agent_socket = tcp://ip-172-40-40-40.eu-central-1.compute.internal:8307\nblackfire.agent_timeout = 0.25\n```\n\n\u003e You may tweak other Blackfire parameters.\n\u003e [See Blackfire documentation about them](https://blackfire.io/docs/configuration/php#configuring-the-probe-via-the-php-ini-configuration-file).\n\nThen modify your [agent config](https://blackfire.io/docs/reference-guide/configuration#agent-configuration)\nto make sure you are listening to `tcp://0.0.0.0:8307`.\n\nThis [blog post](https://developer.happyr.com/installing-blackfire-multiple-servers)\ncould be helpful as it describes how to install the Blackfire Agent.\n\n### ODBC Snowflake setup\n\nYou need to set the environment variable `ODBCSYSINI: /opt/snowflake_odbc/conf/` in your `serverless.yaml`\nin order to tell unixODBC to load the ini file of the snowflake client.\n\nYou can then use snowflake like this: `odbc_connect('DRIVER=SnowflakeDSIIDriver;Server=[name].snowflakecomputing.com;Account=;Schema=;Warehouse=;Database=;Role=', 'username', 'password')`.\n\nThere is more information about the driver ini configuration in the [snowflake client documentation](https://docs.snowflake.com/en/user-guide/odbc-linux.html#step-4-configure-the-odbc-driver)\nbut the default configuration is enough in most cases.\nThe easiest way review those is to download the [`snowflake_odbc` directory](https://sfc-repo.snowflakecomputing.com/odbc/linux/index.html).\n\n### Symfony Runtime\n\nRead [docs at runtime/bref](https://github.com/php-runtime/bref).\n\n### SQL Server setup\n\nThe SQL Server layer includes both the SQLSRV extension and the PDO_SQLSRV extension ([source](https://github.com/microsoft/msphpsql)).\nIf you are unsure of which extension to use, this [stackoverflow post](https://stackoverflow.com/questions/11614536/sqlsrv-driver-vs-pdo-driver-for-php-with-ms-sql-server) may be helpful.\nYou need to set the environment variable `ODBCSYSINI: /opt/microsoft/conf/`\nin your `serverless.yaml` in order to tell unixODBC to load the required ini files.\n\n### New Relic\n\nRead [the New Relic tutorial](docs/newrelic.md).\n\n### Datadog\n\nRead [the Datadog tutorial](docs/datadog.md).\n\n## Docker images\n\nThere are Docker images for every layer. They are updated on every push to master\nand on every tag. The name of the image is `bref/extra-[name]-php-[version]`. Find\nall images on [Docker hub](https://hub.docker.com/u/bref).\n\nThese are the same docker images that creates the layers. All layer files lives inside\nthe `/opt` directory in the image.\n\n### Local Development\n\nWhen developing locally you can build your own images with the required extensions. Example with PHP 8.2 and MongoDB Extension:\n\ndocker-compose.yml\n```\n  php:\n    build:\n      context: .\n      dockerfile: Dockerfile-phpFpm\n    volumes:\n      - .:/var/task:ro\n```\n\nDockerfile-phpFpm\n```\nFROM bref/php-82-fpm-dev:3\nCOPY --from=bref/extra-mongodb-php-82:3 /opt /opt\n```\n\n## For contributors and maintainers\n\n### Creating a new layer\n\nThe idea is to start from bref/build-php-XX, install all libraries and extensions\nyou want, then move all related files to `/opt`. Those files will be available in\nthe same location on the Lambda.\n\nNote that one can't just move files/libraries around. Most of them are expected to\nbe in their \"standard\" location.\n\n1. Create a new folder in `layers` and name it to your extension name.\n1. Add your Dockerfile\n1. Create a config.json file at root of your layer directory specifying php versions it is built for\n1. Create a test.php file with a small test that makes sure the extension is loaded\n1. Update the table in the readme\n\nPlease refer [here](docs/create_your_own_extension_layer.md) for more details.\n\n### Testing the layer\n\n```\n# Test all layers and PHP versions\nmake test\n\n# Test only a single layer\nlayer=imagick make test\n\n# Test a single layer on a single PHP version\nlayer=imagick php_versions=81 make test\n```\n\nYou can publish the layer in your AWS account to test it in AWS Lambda as well:\n\n```\n# Publish a single layer on a single PHP version in a single region\nlayer=imagick php_versions=81 only_region=us-east-1 make publish\n```\n\n### Deploy new versions\n\n#### Use Github actions\n\nPrepare the changelog with some release notes. Then push your changes to `prepare-release` branch.\nThe Github Action will build an publish layers and then commit the `layers.json` to your PR.\n\nNow you will just merge and create a tag.\n\n#### The manual way\n\n```\nexport AWS_PROFILE=my_profile\nmake publish\ngit add layers.json\ngit commit -m \"New version of layers\"\ngit push\n```\n\n#### Config\n\nYou can also build only one specific layer by providing `layer=blackfire` to `make`.\nSame thing for some specific version(s) of php by providing `php_versions=\"80 81\"` to `make`.\nYou can invoke both ways:\n\n```shell\n# First way: make with named arguments\nmake layer=gd php_versions=81\n# Second way: environment variables passed to make\nlayer=blackfire php_versions=81 make\n```\n\n## Lambda layers in details\n\n\u003e **Notice:** this section is only useful if you want to learn more.\n\nThe lambda layers follow this pattern:\n\n```\narn:aws:lambda:\u003cregion\u003e:403367587399:layer:\u003clayer-name\u003e:\u003clayer-version\u003e\n```\n\nSee the [latest layer versions](https://raw.githubusercontent.com/brefphp/extra-php-extensions/master/layers.json).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrefphp%2Fextra-php-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrefphp%2Fextra-php-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrefphp%2Fextra-php-extensions/lists"}