├── .github └── FUNDING.yml ├── Aliases └── php@8.4-enchant ├── Formula ├── php-enchant.rb ├── php@8.1-enchant.rb ├── php@8.1-imap.rb ├── php@8.1-oci8.rb ├── php@8.1-pdo-oci.rb ├── php@8.1-snmp.rb ├── php@8.2-enchant.rb ├── php@8.2-imap.rb ├── php@8.2-oci8.rb ├── php@8.2-pdo-oci.rb ├── php@8.2-snmp.rb ├── php@8.3-enchant.rb ├── php@8.3-imap.rb ├── php@8.3-oci8.rb ├── php@8.3-pdo-oci.rb └── php@8.3-snmp.rb ├── LICENSE.txt ├── README.md ├── azure-pipelines.yml └── lib ├── oracle_php_extension_formula.rb └── php_extension_formula.rb /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: kabel 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /Aliases/php@8.4-enchant: -------------------------------------------------------------------------------- 1 | ../Formula/php-enchant.rb -------------------------------------------------------------------------------- /Formula/php-enchant.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpEnchant < PhpExtensionFormula 4 | extension_dsl "Enchant Extension" 5 | 6 | depends_on "enchant" 7 | end 8 | -------------------------------------------------------------------------------- /Formula/php@8.1-enchant.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT81Enchant < PhpExtensionFormula 4 | extension_dsl "Enchant Extension" 5 | 6 | deprecate! date: "2025-12-31", because: :unsupported 7 | 8 | depends_on "enchant" 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.1-imap.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT81Imap < PhpExtensionFormula 4 | extension_dsl "IMAP Extension" 5 | 6 | deprecate! date: "2025-12-31", because: :unsupported 7 | 8 | depends_on "imap-uw" 9 | depends_on "openssl@3" 10 | depends_on "krb5" 11 | 12 | configure_arg %W[ 13 | --with-imap=#{Formula["imap-uw"].opt_prefix} 14 | --with-imap-ssl=#{Formula["openssl@3"].opt_prefix} 15 | --with-kerberos 16 | ] 17 | 18 | def install 19 | ENV["PHP_OPENSSL"] = "yes" 20 | super 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /Formula/php@8.1-oci8.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/oracle_php_extension_formula" 2 | 3 | class PhpAT81Oci8 < OraclePhpExtensionFormula 4 | extension_dsl "OCI8 Extension" 5 | 6 | deprecate! date: "2025-12-31", because: :unsupported 7 | 8 | instantclient_options arg: "--with-oci8" 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.1-pdo-oci.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/oracle_php_extension_formula" 2 | 3 | class PhpAT81PdoOci < OraclePhpExtensionFormula 4 | extension_dsl "PDO Driver OCI" 5 | 6 | deprecate! date: "2025-12-31", because: :unsupported 7 | 8 | instantclient_options arg: "--with-pdo-oci", with_version: true 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.1-snmp.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT81Snmp < PhpExtensionFormula 4 | extension_dsl "SNMP Extension" 5 | 6 | deprecate! date: "2025-12-31", because: :unsupported 7 | 8 | depends_on "net-snmp" 9 | depends_on "openssl@3" 10 | 11 | configure_arg "--with-snmp=#{Formula["net-snmp"].opt_prefix}" 12 | end 13 | -------------------------------------------------------------------------------- /Formula/php@8.2-enchant.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT82Enchant < PhpExtensionFormula 4 | extension_dsl "Enchant Extension" 5 | 6 | deprecate! date: "2026-12-31", because: :unsupported 7 | 8 | depends_on "enchant" 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.2-imap.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT82Imap < PhpExtensionFormula 4 | extension_dsl "IMAP Extension" 5 | 6 | deprecate! date: "2026-12-31", because: :unsupported 7 | 8 | depends_on "imap-uw" 9 | depends_on "openssl@3" 10 | depends_on "krb5" 11 | 12 | configure_arg %W[ 13 | --with-imap=#{Formula["imap-uw"].opt_prefix} 14 | --with-imap-ssl=#{Formula["openssl@3"].opt_prefix} 15 | --with-kerberos 16 | ] 17 | 18 | def install 19 | ENV["PHP_OPENSSL"] = "yes" 20 | super 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /Formula/php@8.2-oci8.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/oracle_php_extension_formula" 2 | 3 | class PhpAT82Oci8 < OraclePhpExtensionFormula 4 | extension_dsl "OCI8 Extension" 5 | 6 | deprecate! date: "2026-12-31", because: :unsupported 7 | 8 | instantclient_options arg: "--with-oci8" 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.2-pdo-oci.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/oracle_php_extension_formula" 2 | 3 | class PhpAT82PdoOci < OraclePhpExtensionFormula 4 | extension_dsl "PDO Driver OCI" 5 | 6 | deprecate! date: "2026-12-31", because: :unsupported 7 | 8 | instantclient_options arg: "--with-pdo-oci", with_version: true 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.2-snmp.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT82Snmp < PhpExtensionFormula 4 | extension_dsl "SNMP Extension" 5 | 6 | deprecate! date: "2026-12-31", because: :unsupported 7 | 8 | depends_on "net-snmp" 9 | depends_on "openssl@3" 10 | 11 | configure_arg "--with-snmp=#{Formula["net-snmp"].opt_prefix}" 12 | end 13 | -------------------------------------------------------------------------------- /Formula/php@8.3-enchant.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT83Enchant < PhpExtensionFormula 4 | extension_dsl "Enchant Extension" 5 | 6 | deprecate! date: "2027-12-31", because: :unsupported 7 | 8 | depends_on "enchant" 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.3-imap.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT83Imap < PhpExtensionFormula 4 | extension_dsl "IMAP Extension" 5 | 6 | deprecate! date: "2027-12-31", because: :unsupported 7 | 8 | depends_on "imap-uw" 9 | depends_on "openssl@3" 10 | depends_on "krb5" 11 | 12 | configure_arg %W[ 13 | --with-imap=#{Formula["imap-uw"].opt_prefix} 14 | --with-imap-ssl=#{Formula["openssl@3"].opt_prefix} 15 | --with-kerberos 16 | ] 17 | 18 | def install 19 | ENV["PHP_OPENSSL"] = "yes" 20 | super 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /Formula/php@8.3-oci8.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/oracle_php_extension_formula" 2 | 3 | class PhpAT83Oci8 < OraclePhpExtensionFormula 4 | extension_dsl "OCI8 Extension" 5 | 6 | deprecate! date: "2027-12-31", because: :unsupported 7 | 8 | instantclient_options arg: "--with-oci8" 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.3-pdo-oci.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/oracle_php_extension_formula" 2 | 3 | class PhpAT83PdoOci < OraclePhpExtensionFormula 4 | extension_dsl "PDO Driver OCI" 5 | 6 | deprecate! date: "2027-12-31", because: :unsupported 7 | 8 | instantclient_options arg: "--with-pdo-oci", with_version: true 9 | end 10 | -------------------------------------------------------------------------------- /Formula/php@8.3-snmp.rb: -------------------------------------------------------------------------------- 1 | require_relative "../lib/php_extension_formula" 2 | 3 | class PhpAT83Snmp < PhpExtensionFormula 4 | extension_dsl "SNMP Extension" 5 | 6 | deprecate! date: "2027-12-31", because: :unsupported 7 | 8 | depends_on "net-snmp" 9 | depends_on "openssl@3" 10 | 11 | configure_arg "--with-snmp=#{Formula["net-snmp"].opt_prefix}" 12 | end 13 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2009-present, Homebrew contributors 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://repository-images.githubusercontent.com/127686768/dc404b00-f5dd-11ea-95bd-7de02ed45411) 2 | 3 | # kabel/php-ext 4 | [![](https://img.shields.io/github/sponsors/kabel?style=social)](https://github.com/sponsors/kabel/) 5 | [![](https://img.shields.io/azure-devops/build/kevinabel0613/kevinabel/2?style=social)](https://dev.azure.com/kevinabel0613/kevinabel/_build?definitionId=2) 6 | 7 | Core PHP extension formulae for the Homebrew package manager. These extensions are not a part of [Homebrew/core](https://github.com/Homebrew/homebrew-core/) because they are either not popular enough or have known stability problems. 8 | 9 | This tap includes one of the sources for the popular `imap` extension that isn't included in the core homebrew `php` formulae because of default system performance issues. 10 | 11 | ## What about other formulae (PECL)? 12 | Users have previously asked about a tap that contains pre-built binary packages (bottles) of other PHP extensions, like `xdebug` and `imagick`. Initially I didn't want to try and support those and encouraged users to use the `pecl` installer. Now that the upstream PHP team is phasing out the PEAR/PECL tools in the newest releases, I've started a new tap that has some of the most popular extensions from the PECL registry. 13 | 14 | See [kabel/pecl](https://github.com/kabel/homebrew-pecl). And consider tapping it too: `brew tap kabel/pecl` 15 | 16 | ## How do I install these formulae? 17 | 18 | Run 19 | 20 | ```sh 21 | brew tap kabel/php-ext 22 | ``` 23 | 24 | followed by 25 | 26 | ```sh 27 | brew install 28 | ``` 29 | 30 | ## Troubleshooting 31 | First, please run `brew update` and `brew doctor`. 32 | 33 | If you can an error about the `master` branch, please try `brew update-reset` to fix the default branch association to `main`. 34 | 35 | Second, read the [Troubleshooting Checklist](https://docs.brew.sh/Troubleshooting). 36 | 37 | **If you don't read these it will take us far longer to help you with your problem.** 38 | 39 | ## License 40 | Code is under the [BSD 2-clause "Simplified" License](https://github.com/Homebrew/homebrew-core/blob/master/LICENSE.txt). 41 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: macOS 3 | pool: 4 | vmImage: macOS-latest 5 | steps: 6 | - bash: | 7 | set -e 8 | brew update-reset 9 | sudo rm -rf /usr/local/include/node 10 | HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/kabel/homebrew-php-ext" 11 | mkdir -p "$HOMEBREW_TAP_DIR" 12 | rm -rf "$HOMEBREW_TAP_DIR" 13 | ln -s "$PWD" "$HOMEBREW_TAP_DIR" 14 | if [ -z "$SYSTEM_PULLREQUEST_TARGETBRANCH" ]; then export SYSTEM_PULLREQUEST_TARGETBRANCH="main"; fi 15 | if [ "$BUILD_REASON" = "PullRequest" ]; then export GITHUB_EVENT_NAME="pull_request"; fi 16 | export GITHUB_BASE_REF="$SYSTEM_PULLREQUEST_TARGETBRANCH" 17 | export GITHUB_SHA="$BUILD_SOURCEVERSION" 18 | export GITHUB_ACTIONS="fake" 19 | export GITHUB_REPOSITORY="$BUILD_REPOSITORY_NAME" 20 | export GITHUB_REF="$BUILD_SOURCEBRANCH" 21 | export HOMEBREW_GITHUB_ACTIONS=fake 22 | echo "==> Dumping Pipelines Vars..." 23 | echo "BUILD_REPOSITORY_NAME=$BUILD_REPOSITORY_NAME" 24 | echo "BUILD_SOURCEBRANCH=$BUILD_SOURCEBRANCH" 25 | echo "BUILD_SOURCEBRANCHNAME=$BUILD_SOURCEBRANCHNAME" 26 | echo "BUILD_SOURCEVERSION=$BUILD_SOURCEVERSION" 27 | echo "BUILD_REASON=$BUILD_REASON" 28 | echo "SYSTEM_PULLREQUEST_SOURCEBRANCH=$SYSTEM_PULLREQUEST_SOURCEBRANCH" 29 | echo "SYSTEM_PULLREQUEST_TARGETBRANCH=$SYSTEM_PULLREQUEST_TARGETBRANCH" 30 | echo 31 | TEST_PARAMS="" 32 | if [ "$BUILD_REASON" != "PullRequest" -a "$BUILD_SOURCEBRANCHNAME" = "$SYSTEM_PULLREQUEST_TARGETBRANCH" ]; then TEST_PARAMS="--only-tap-syntax"; fi 33 | brew test-bot --tap=kabel/php-ext $TEST_PARAMS 34 | displayName: Run brew test-bot 35 | -------------------------------------------------------------------------------- /lib/oracle_php_extension_formula.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "../lib/php_extension_formula" 4 | 5 | class OraclePhpExtensionFormula < PhpExtensionFormula 6 | def install 7 | (prefix/"instantclient").install resource("instantclient-basic") 8 | (prefix/"instantclient").install resource("instantclient-sdk") 9 | 10 | instantclient_version = resource("instantclient-basic") 11 | .version 12 | .to_s 13 | .split("-")[0] 14 | 15 | arg = "#{self.class.instantclient_arg}=instantclient,#{prefix}/instantclient" 16 | arg += ",#{instantclient_version}" if self.class.instantclient_with_version 17 | 18 | configure_args << arg 19 | super 20 | end 21 | 22 | def caveats 23 | <<~EOS 24 | Installing this Formula means you have AGREED to the Oracle Technology Network License Agreement at 25 | 26 | http://www.oracle.com/technetwork/licenses/instant-client-lic-152016.html 27 | 28 | You must also have an Oracle Account. You can register for a free account at 29 | 30 | https://profile.oracle.com/myprofile/account/create-account.jspx 31 | EOS 32 | end 33 | 34 | class << self 35 | attr_reader :instantclient_arg, :instantclient_with_version 36 | 37 | def instantclient_options(options) 38 | @instantclient_arg = options[:arg] 39 | @instantclient_with_version = options[:with_version] 40 | end 41 | 42 | def extension_dsl(*) 43 | super 44 | resource "instantclient-basic" do 45 | url "https://download.oracle.com/otn_software/mac/instantclient/198000/instantclient-basic-macos.x64-19.8.0.0.0dbru.zip" 46 | sha256 "57ed4198f3a10d83cd5ddc2472c058d4c3b0b786246baebf6bbfc7391cc12087" 47 | end 48 | 49 | resource "instantclient-sdk" do 50 | url "https://download.oracle.com/otn_software/mac/instantclient/198000/instantclient-sdk-macos.x64-19.8.0.0.0dbru.zip" 51 | sha256 "0fa8ae4c4418aa66ce875cf92e728dd7a81aeaf2e68e7926e102b5e52fc8ba4c" 52 | end 53 | end 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lib/php_extension_formula.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PhpExtensionFormula < Formula 4 | desc "PHP Extension" 5 | homepage "https://www.php.net/" 6 | 7 | def initialize(name, path, spec, alias_path: nil, tap: nil, force_bottle: false) 8 | super 9 | active_spec.owner = php_parent.stable.owner 10 | end 11 | 12 | def install 13 | cd "ext/#{extension}" 14 | system php_parent.bin/"phpize" 15 | inreplace "configure", 16 | "EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null`", 17 | "EXTENSION_DIR=#{lib/module_path}" 18 | system "./configure", *configure_args 19 | system "make", "phpincludedir=#{include}/php", "install" 20 | end 21 | 22 | def post_install 23 | ext_config_path = etc/"php"/php_parent.version.major_minor/"conf.d"/"ext-#{extension}.ini" 24 | if ext_config_path.exist? 25 | inreplace ext_config_path, 26 | /#{extension_type}=.*$/, 27 | "#{extension_type}=#{opt_lib/module_path}/#{extension}.so" 28 | else 29 | ext_config_path.write <<~EOS 30 | [#{extension}] 31 | #{extension_type}=#{opt_lib/module_path}/#{extension}.so 32 | EOS 33 | end 34 | end 35 | 36 | test do 37 | assert_match(/^#{extension}$/i, 38 | shell_output("#{php_parent.opt_bin}/php -m"), 39 | "failed to find extension in php -m output") 40 | end 41 | 42 | private 43 | 44 | delegate [:php_parent, :extension, :configure_args] => :"self.class" 45 | 46 | def extension_type 47 | # extension or zend_extension 48 | "extension" 49 | end 50 | 51 | def module_path 52 | extension_dir = Utils.safe_popen_read(php_parent.opt_bin/"php-config", "--extension-dir").chomp 53 | php_basename = File.basename(extension_dir) 54 | "php/#{php_basename}" 55 | end 56 | 57 | class << self 58 | NAME_PATTERN = /^Php(?:AT([578])(\d+))?(.+)/ 59 | attr_reader :configure_args, :php_parent, :extension 60 | 61 | def configure_arg(args) 62 | @configure_args ||= [] 63 | @configure_args.concat(Array(args)) 64 | end 65 | 66 | def extension_dsl(description = nil) 67 | class_name = name.split("::").last 68 | m = NAME_PATTERN.match(class_name) 69 | raise "Bad PHP Extension name for #{class_name}" if m.nil? 70 | 71 | if m[1].nil? 72 | parent_name = "php" 73 | else 74 | parent_name = "php@#{m.captures[0..1].join(".")}" 75 | keg_only :versioned_formula 76 | end 77 | 78 | @php_parent = Formula[parent_name] 79 | @extension = m[3].gsub(/([a-z])([A-Z])/) do 80 | "#{Regexp.last_match(1)}_#{Regexp.last_match(2)}" 81 | end.downcase 82 | @configure_args = %W[ 83 | --with-php-config=#{php_parent.opt_bin/"php-config"} 84 | ] 85 | 86 | desc "#{description} for PHP #{php_parent.version.major_minor}" unless description.nil? 87 | 88 | homepage php_parent.homepage + extension 89 | url php_parent.stable.url 90 | sha256 php_parent.stable.checksum.hexdigest 91 | 92 | depends_on "autoconf" => :build 93 | depends_on "pkg-config" => :build 94 | depends_on parent_name 95 | end 96 | end 97 | end 98 | --------------------------------------------------------------------------------