How to set VS Code extension Intelephense for PHP 8? - php

I would like to set my bought Visual Studio Code extension to use PHP 8 version for it's "intelisense" functionality.
Checking defaultSettings.json for 'intelephense' search query gives lots of hits, but only one stands out to me for upgrading to PHP 8:
// A semver compatible string that represents the target PHP version. Used for providing version appropriate suggestions and diagnostics. PHP 5.3.0 and greater supported.
"intelephense.environment.phpVersion": "7.4.0",
This should probably be changed in Workspace Settings .vscode\settings.json to
"intelephense.environment.phpVersion": "8.1.0-dev", // or would "8.0.0" be better?
Is there anything else that needs to be changed?
I am using Laragon for local development with PHP 7.2 and 8.0 installed. Staging and production servers use PHP 8.0.

Related

VS Code shows me errors due to local PHP version

I am currently working on a PHP Laravel project. For this project I need at least PHP 8.1, so I have a PHP Docker instance. On my Mac I have php 7.3.24. The project runs as expected. But my IDE (VS Code) gives me an error message in many places due to the local PHP version. For example, the typehint of class variables.
In addition, included libraries are not recognised when I want to initiate them (undefined type).
My question: Do I have to upgrade the local PHP version or is there a setting in the IDE?

PHPSpreadsheet issue with PHP v5.5

This isn't particularly a coding question.
I have a script running locally (PHP V5.6) and it's absolutely perfect.
However, I FTPd it to our dev server to run as a cron and it failed. Our server has php v5.5 running for dependancy issues. Is there any way I can user composer require to install phpspreadsheet on a machine running PHP 5.5?
PHPSpreadsheet was deliberately written for PHP >=5.6.0 because I was fed up with the way people had made death threats to me for even suggesting that the minimum version of PHP required to run its predecessor (PHPExcel) should be increased from PHP 5.2 to take advantage of newer features of the language to reduce the codebase and memory footprint, and make it more performant
PHPSpreadsheet uses features of PHP that are only available in PHP 5.6 or above, and will soon drop support for even that version when Security support ends for that version of PHP on 31 Dec 2018, and require a minimum of PHP 7.1.0
If you need to create spreadsheets using older unsupported versions of PHP, then you can't use PHPSpreadsheet, and can only use its predecessor PHPExcel
No, PhpSperadsheet requires v5.6 or above.
In the docs # https://phpspreadsheet.readthedocs.io/en/develop/
Software requirements
The following software is required to develop using PhpSpreadsheet:
**PHP version 5.6 or newer**
PHP extension php_zip enabled
PHP extension php_xml enabled
PHP extension php_gd2 enabled (if not compiled in)
Try upgrading PHP.

Change PHP Language Library in eclipse Oxygen

Eclipse for PHP Developers
Version: Oxygen Release (4.7.0)
Build id: 20170620-1800
How can I change the PHP Language Library to PHP 7 (see screen below)? The project results from a previous eclipse version which has been imported to Oxygen. On my machine no PHP is installed, I use Xdebug with a Linux VM, the workspace is on a samba share on that VM (runs PHP 7.0 on Apache).
In the preferences I can add PHP paths, but I have no access to the PHP directory on the Linux VM. But when I create a new PHP project in eclipse, I can select a PHP version (including 7.0).
I wonder if it is the only chance to create a new PHP 7.0 project and copy my files over, or is there a way to alter the PHP 5.6 to PHP 7.0?
Edit: based on howlger's answer
Yes, PHP validation solves it.
I was looking under Validation where is no such thing
Right-click on the project folder and choose Properties
In the properties dialog, in PHP > Validation
Enable project specific settings
As PHP Version choose
7.0 (uniform variable syntax, scalar type hint,...) or
7.1 (void return types, class constant visibility,...)
You also might configure installed PHPs: Window > Properties: PHP > Installed PHPs
See also PHP help: PHP Interpreter Properties

php extension compatability with php 5.6.6 or higher

Is any one installed the following library or extension (curl,libcurl,pearl,pecl,mongodb driver for php) with php 5.6.6 or higher not 7 in Ubuntu 14
I have used all of this with php 5.5 now I afraid of version compatibility,
if any one ensure me to can I migrate from Ubuntu 12.0.4 to 14 and php 5.5 to 5.6.6 or higher ?
The library or extension are third party softwares which they are developed by there own and able to bind in PHP or any other language.
E.g. CURL library is developed in C and it can be used or bind in many different languages.
Also it is good to stay always up-to date, while upgrading to new version E.g PHP, you can check the change-log of version and base on that you can understand, Is any library supporting change or not.
Many Web Servers are always try to upgrade or staying latest versions of languages or you can also inform them to upgrade server base on requirement and they will do, so it is no worry about server configuration.
From my system I upgraded from Ubuntu 12.4 to 14.4 and currently PHP version is 5.5.9 and every library is working fine.
And thing is that when the language version upgraded some good stuff also come, some bugs are fixed. So its cool stuff to always stay up

MAMP PHP vs Apple's installed version

I would like to use MAMP's version of PHP for my local PHP testing and development. I understand that Macs come with a version of PHP installed. I have installed MAMP and everything seems to be going smoothly except error reporting.
In Terminal I have checke which version of PHP my machine is using and it is not the one from MAMP. I have changed MAMP's php.ini files to report all errors. I am not getting any errors in my testing. I am inserting obvious errors to test for.
My questions are:
How can I disable or remove the preinstalled version of PHP?
How can I set my machine to use only MAMP's version of PHP?
Can I test multiple versions of PHP at once? Is it recommended?
How can I stay up to date with the latest version of PHP? Is it like normal Software Updates?
-Josh
Add/change following line in ~/.profile or ~/.bashrc (for bash):
export
PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.2.17/bin:/usr/local/bin:$PATH:/opt/local/bin
and after that please re-login (or just execute e.g. /bin/bash).
From http://drupal.org/node/1464236
You can change the version # to the version you want.

Categories