Do you miss that the version numbers of your PHP dependencies are automatically updated in the composer.json file after a composer update? Just like npm or yarn are updating the version numbers in the package.json file.
Then upgrade to Composer 2.4 and say hi tocomposer dump. This version introduced a new command composer bump which will update your composer.json file to the precise version which is pinned in the composer.lock file. It basically will sync the composer.json with the composer.lock versions and will keep the caret version constraints, so you can still make minor or patch version upgrades.
I had the task the other day to use a headless chrome to generate PDF files from websites in a PHP app.
The plan was to use chrome-php with a headless chrome to generate the PDF.
Usually you would install chrome/chromium on a linux server via apt and just run chrome from the PATH with chrome. Since i was on shared hosting i was not sure if this was possible since i was not allowed to run apt commands. So i tried to use Puppeteer which ships a headless chrome executable and use just this directly. I installed Puppeteer with npm locally and uploaded the chrome executable to the shared hosting. Puppeteer will place the headless chrome in the .cache dir in your home directory, f.e.:
$file = 'path/to/file.txt';
$response = new BinaryFileResponse($file);Code language:PHP(php)
But in some cases you might want to create an image dynamically and return it directly from the controller without storing it on the filesystem. So you can create your image with the GD library and directly stream the GDImage object from the symfony controller with the StreamedResponse class.
Using Postgres with the Postgis extension to integrate GeoData / GIS functionality in your project is not natively supported by Doctrine and Doctrine migrations.
First you have to add the extension to Postgres, even if you use the Postgis docker image like postgis/postgis:14-3.3-alpine.
So add this SQL statement to the up method of your first migration: $this->addSql('CREATE EXTENSION IF NOT EXISTS postgis;');
and the DROP statement for the extension to the down method: $this->addSql('DROP EXTENSION postgis;');
Now, when using Doctrine with Postgres and Postgis extension, migrations still behave a bit odd and try to remove Sequences created by Postgis, because Doctrine migrations does not take Postgis extension’ s built-in Sequences into account.
Are you annoyed of too many deprecation warnings in you logs of your symfony app? Probably yes because it is really a lot of noise. However deprecation logs are still useful to ensure future compatibility of your app.
So since version 5.1 symfony will log deprecations to a dedicated log channel when it exists and ships with this monolog config:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it existsCode language:PHP(php)
This is added already in the recipe and ships when installing symfony.
Ok, but the handler for this deprecation channel is not configured, so you have to do this yourself. How? Add this to your monolog config:
Since SilverStripe 4.10 is not yet fully ready for PHP8.1 you wil receive quite some deprecation warnings in dev mode when you are brave and run it nonetheless on PHP8.1.
Deprecated: SilverStripe\Config\Collections\MemoryConfigCollection implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/html/vendor/silverstripe/config/src/Collections/MemoryConfigCollection.php on line 13
Unfortunatly we can’t control the error_reporting from SilverStripe since it is set in the kernel of the framework. So we are forced to hack the Kernel which is rather unfortunate.
In the SilverStripe Slack channel someone proposed to use composer-patch which will apply a patch to a given vendor dependency during composer install. This is quite cool because you don’t need to fork the dependency and take care of getting upstream changes.
We use technologies like cookies to store and/or access device information. We do this to improve browsing experience and to show personalized ads. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.