Skip to content

PHP 8.0 Support #1084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
reedy opened this issue Dec 1, 2020 · 15 comments
Closed

PHP 8.0 Support #1084

reedy opened this issue Dec 1, 2020 · 15 comments

Comments

@reedy
Copy link
Contributor

reedy commented Dec 1, 2020

Following on from the clarification requested in #1083 and #1028 as the next major release...

Is the elasticsearch-php 8.0 release going to have PHP 8 support?

@reedy
Copy link
Contributor Author

reedy commented Dec 1, 2020

It was a question brought up in ruflin/Elastica#1799 (comment) to help them work out when to do a ruflin/Elastica release with PHP 8.0 support too; which is not so helpful if elasticsearch-php doesn't support it in a release :)

@sebsel
Copy link

sebsel commented Dec 2, 2020

Note that before elastic/elasticsearch-php can be upgraded, the dependency cpliakas/git-wrapper ~2.0 must be updated to support PHP 8 too.

@reedy
Copy link
Contributor Author

reedy commented Dec 2, 2020

Note that before elastic/elasticsearch-php can be upgraded, the dependency cpliakas/git-wrapper ~2.0 must be updated to support PHP 8 too.

Looks like a bump to ~3.0.3 (or at least allowing that version) would suffice (along with any code changes as appropriate). 3.0.2 still has ^7.2 for PHP support

@sebsel
Copy link

sebsel commented Dec 2, 2020

Yes, that does seem to work. After that there is only the problem of phpunit/phpunit ^7.5, with phpunit 8 having you add : void after all setUp() tearDown() methods on tests and some other deprecations.

@sebsel
Copy link

sebsel commented Dec 2, 2020

Linking this PR up for discoverability: #1063

@reedy
Copy link
Contributor Author

reedy commented Dec 2, 2020

Yes, that does seem to work. After that there is only the problem of phpunit/phpunit ^7.5, with phpunit 8 having you add : void after all setUp() tearDown() methods on tests and some other deprecations.

Dropping PHP 7.1 support would help here... 7.1 has been EOL for about a year at this point

And PHPUnit 7 doesn't support PHP 7.4 either (and is EOL itself too)

PHPUnit 8 supports PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0

https://phpunit.de/supported-versions.html

Time to file another task

@michaeldnelson
Copy link

I'm sorry if this has been covered somewhere already. Is there an ETA on PHP 8 support or are we in a wait and see situation? I foolishly started a port of my existing codebase and missed this dependency.

@ezimuel
Copy link
Contributor

ezimuel commented Dec 16, 2020

PHP 8 is supported in 7.x branch. I'll ship this it in 7.11 release, when Elasticsearch 7.11 will be released.
Regarding PHP 7.1 support we need to have it until Elasticsearch 8.

@ezimuel ezimuel closed this as completed Dec 16, 2020
@lapwingcloud
Copy link

lapwingcloud commented Jan 7, 2021

Will PHP 8 support be backported to elasticsearch-php 6.x and 5.x?
Still using ES 5.

@lapwingcloud
Copy link

OK for anyone interested, I found the answer here #1083 (comment),
which is PHP 8 support won't be backported to elasticsearch-php 6.x and 5.x

@jitheshjs983
Copy link

jitheshjs983 commented Apr 14, 2022

Hi
i upgraded my php version to 8.0.17 , tamayo/laravel-scout-elastic version to 8.1 and elasticsearch/elasticsearch version to 8.0
After that i'm getting some error saying Please install the Elasticsearch PHP client: elasticsearch/elasticsearch in LaravelScoutElasticProvider.php line 42

I can see that the error is throwing because the class is not loading ClientBuilder

Can anyone help me on this ?

@me-masoud
Copy link

Hi i upgraded my php version to 8.0.17 , tamayo/laravel-scout-elastic version to 8.1 and elasticsearch/elasticsearch version to 8.0 After that i'm getting some error saying Please install the Elasticsearch PHP client: elasticsearch/elasticsearch in LaravelScoutElasticProvider.php line 42

I can see that the error is throwing because the class is not loading ClientBuilder

Can anyone help me on this ?

I have same issue

@reedy
Copy link
Contributor Author

reedy commented Aug 6, 2022

https://github.com/elastic/elasticsearch-php/blob/8.0/src/ClientBuilder.php exists in the branch..

reedy@ubuntu64-web-esxi:~/1084$ composer init

                                            
  Welcome to the Composer config generator  
                                            


This command will guide you through creating your composer.json config.

Package name (<vendor>/<name>) [reedy/1084]: 
Description []: 
Author [Reedy <[email protected]>, n to skip]: 
Minimum Stability []: 
Package Type (e.g. library, project, metapackage, composer-plugin) []: 
License []: 

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]? Yes
Search for a package: elasticsearch/elasticsearch
Info from https://repo.packagist.org: #StandWithUkraine
Enter the version constraint to require (or leave blank to use the latest version): 8.0
Search for a package: 
Would you like to define your dev dependencies (require-dev) interactively [yes]? no
Add PSR-4 autoload mapping? Maps namespace "Reedy\1084" to the entered relative path. [src/, n to skip]: n 

{
    "name": "reedy/1084",
    "require": {
        "elasticsearch/elasticsearch": "8.0"
    },
    "authors": [
        {
            "name": "Reedy",
            "email": "[email protected]"
        }
    ]
}

Do you confirm generation [yes]? yes
Would you like to install dependencies now [yes]? yes
Loading composer repositories with package information
Updating dependencies
Lock file operations: 14 installs, 0 updates, 0 removals
  - Locking elastic/transport (v8.3.0)
  - Locking elasticsearch/elasticsearch (v8.0.0)
  - Locking guzzlehttp/guzzle (7.4.5)
  - Locking guzzlehttp/promises (1.5.1)
  - Locking guzzlehttp/psr7 (2.4.0)
  - Locking php-http/discovery (1.14.3)
  - Locking php-http/httplug (2.3.0)
  - Locking php-http/promise (1.1.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (3.0.0)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking symfony/deprecation-contracts (v3.1.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 14 installs, 0 updates, 0 removals
  - Downloading psr/log (3.0.0)
  - Downloading php-http/promise (1.1.0)
  - Downloading php-http/httplug (2.3.0)
  - Downloading php-http/discovery (1.14.3)
  - Downloading elastic/transport (v8.3.0)
  - Downloading elasticsearch/elasticsearch (v8.0.0)
  - Installing psr/log (3.0.0): Extracting archive
  - Installing psr/http-message (1.0.1): Extracting archive
  - Installing psr/http-client (1.0.1): Extracting archive
  - Installing symfony/deprecation-contracts (v3.1.1): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-factory (1.0.1): Extracting archive
  - Installing guzzlehttp/psr7 (2.4.0): Extracting archive
  - Installing guzzlehttp/promises (1.5.1): Extracting archive
  - Installing guzzlehttp/guzzle (7.4.5): Extracting archive
  - Installing php-http/promise (1.1.0): Extracting archive
  - Installing php-http/httplug (2.3.0): Extracting archive
  - Installing php-http/discovery (1.14.3): Extracting archive
  - Installing elastic/transport (v8.3.0): Extracting archive
  - Installing elasticsearch/elasticsearch (v8.0.0): Extracting archive
2 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
4 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
reedy@ubuntu64-web-esxi:~/1084$ php -a
Interactive shell

php > require "vendor/autoload.php";
php > echo class_exists( 'Elastic\\Elasticsearch\\ClientBuilder' );
1

And when installed via composer, seems to work fine too....

@hkulekci
Copy link
Contributor

hkulekci commented Aug 7, 2022

Hi i upgraded my php version to 8.0.17 , tamayo/laravel-scout-elastic version to 8.1 and elasticsearch/elasticsearch version to 8.0 After that i'm getting some error saying Please install the Elasticsearch PHP client: elasticsearch/elasticsearch in LaravelScoutElasticProvider.php line 42
I can see that the error is throwing because the class is not loading ClientBuilder
Can anyone help me on this ?

I have same issue

@jitheshjs983 @masoud-me @reedy As I check on the composer file of that library, the elasticsearch required as development (require-dev). May it be related to this? What do you think?

@reedy
Copy link
Contributor Author

reedy commented Aug 7, 2022

Probably..

The instructions do say to do composer require elasticsearch/elasticsearch - https://github.com/ErickTamayo/laravel-scout-elastic#install-elasticsearch-php-client which just feels weird. especially when it's in require-dev as you say.

It's definitely not a bug in this library, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants