Skip to main content

PHP Collective

Questions

Browse questions with relevant PHP tags

1,464,505 questions

0 votes
0 answers
18 views

WooCommerce Hook is not firing and seem to be deprecated

I know it's 2025, and this problem seems to be all over the place, and I've been trying all the recommended solutions, but it seems it's mostly old code. But I don't really know; I'll try to sum it up ...
Juwe's user avatar
  • 31
1 vote
1 answer
42 views

How can ship multiple different sources for the laravel-vite-plugin besides app.js?

Currently the app has 2 entry points for the JS and CSS files in the blade layout file: {{-- layout.blade.php --}} <head> <meta charset="utf-8" /> <meta name="...
pileup's user avatar
  • 3,462
2 votes
3 answers
63 views

Why does the_field function of ACF plugin return an empty value?

I know that there are similar questions to my question like this one: Insert php variable in a href But my problem does not solve with them! I am using "acf plugin" for adding some codes to ...
hamid-davodi's user avatar
  • 2,024
2 votes
1 answer
41 views

PHPStan complains about @var Builder<ProductTemplate> in Laravel Eloquent scope

I'm trying to define a Laravel Eloquent model with a custom scope that filters categories by a related product's vendor_id. Here's my setup: class Category extends Model { public function ...
melkmeshi's user avatar
0 votes
0 answers
41 views

Azure Table PHP Retrieve Latest Data First with Pagination

I am using this: https://github.com/Azure/azure-storage-table-php to insert data to azure table. However, when I retrieve the data, I don’t get the latest entries unless I use a do...while loop, as ...
nexusmusic's user avatar
2 votes
2 answers
72 views

How to change the title of the billing field?in Woocommerce

I found some old code here to change the name of my 'Deliver to different address?' title in Woocommerce. Works perfectly... but I also want to change the name of my Billing Details title, to Billing ...
Elton's user avatar
  • 21
0 votes
1 answer
51 views

Why Image::make of spatie/laravel-medialibrary raised error? [closed]

In laravel 11 app using spatie/image "^3.8" and spatie/laravel-medialibrary "^11.12" I need to get all properties of image and I do use Spatie\Image\Image; ... $itemMedia = $...
mstdmstd's user avatar
  • 3,309
0 votes
0 answers
55 views

How to install league/csv bundle with Doctrine v3.3 on Symfony?

I am having a problem today installing the league/csv bundle (v9.27) on my Symfony (v7.2) project with doctrine/orm (v3.3)! When I run command php require league/csv, I get this message: Your ...
d3LTa7's user avatar
  • 71
0 votes
0 answers
132 views

404 on certain files on select devices after repeated visits [closed]

I run a webserver on my local network to host my movie collection. I also have a custom android app running on an amazon fire stick. Recently I have been working to enable video playback from external ...
Kilometer Bob's user avatar
-1 votes
0 answers
87 views

How to authenticate API routes in Laravel 12 using Sanctum [closed]

I have a route which I wish to protect with a token, using Sanctum. The offending route is /status, which would be accessed by /api/status. The /foo route works fine, there is only a problem when ...
Kevin Waterson's user avatar
1 vote
1 answer
91 views

Why does Laravel read the schema as if it had 2 primary keys? [duplicate]

Here's my laravel composer.json for its version info: { "name": "laravel/laravel", "type": "project", "description": "The skeleton ...
Evan Fersadi's user avatar
2 votes
2 answers
104 views

Avoiding redundant data in an Eloquent model Instance

I encountered an issue while working on a Laravel project of mine, intended for property rentals. In the database, both the property owner’s and the tenant’s contact information are stored in the same ...
Leandro Caplan's user avatar
Best practices
0 votes
2 replies
42 views

Best way to load a custom JS file only on WooCommerce product pages with a block theme (FSE), not want killing full-page cache?

Please read full first I’m working on a WooCommerce shop using Twenty Twenty-Five as a child block theme (full site editing). I have a small custom script (product.js) that should only run on single ...
Joynal Abed's user avatar
0 votes
1 answer
74 views

How can I use local storage for filament export in production? [closed]

How can I use Filament export in production? I don't want to use S3 and I want to use local storage. The exported files are secure and should not be public. When I use local disk, production ...
Mohammad Pourbehzad's user avatar
0 votes
0 answers
78 views

URL gets generated with &amp; instead of & [closed]

I try to setup SAML authentication in my application but I'm facing a URL My generated URL to SimpleSAML contains &amp; instead of & and SimpleSAML doesn't like it Here is my piece of code ...
Nathan30's user avatar
  • 1,101
3 votes
1 answer
179 views

Why do some web browsers incorrectly display currencies produced by NumberFormatter

Why some older web browsers (not all) incorrectly display currency symbols when symbols are produced by php NumberFormatter() but display correct symbol when given as html entity. Since correct symbol ...
Jimski's user avatar
  • 1,040
-3 votes
0 answers
48 views

How do put text from a text file in my webpage [duplicate]

I'm updating a php website using bootstrap. I have a section that takes the date, and three prices from a comma deliminated text file. (../price/price.txt = (11/23/2025, $2.299, $4.799, $4.1999)). ...
MARCIA MOORE's user avatar
0 votes
1 answer
69 views

Load different service providers based on the environment

In Laravel 12 how can I load different service providers based on the environment? I think the documentation is lacking on this topic. So far I've found 3 potential places: inside the bootstrap/...
zer0uno's user avatar
  • 8,178
-1 votes
0 answers
58 views

How to close the WhatsApp In-App Browser? [closed]

In my project I'm struggling to close the in-app browser in WhatsApp via my project which is used by PHP, JavaScript enter image description here In this image the metro site opened via WhatsApp in ...
Jayadeepan M's user avatar
3 votes
1 answer
64 views

Laravel Fortify ignores custom guard for 2fa

I have a Laravel 12 with 2 guards "web" and "admin", the admin guard has its own user table "admins" (privacy concerns). We have 2 Models "User" and "Admin&...
cari's user avatar
  • 2,341
Best practices
0 votes
2 replies
56 views

Deploying a Livewire and Flux Laravel Project on XAMPP and cPanel

I'm trying to set up a Livewire Starter Kit project inside XAMPP (in Windows). However, I'm running into issues getting it to work correctly. For example, Livewire components don't render properly, ...
mouad12300's user avatar
3 votes
1 answer
66 views

Problem Searching Using Blind Index in Laravel

I am developing an application that contains sensitive data, and I want this data to be encrypted while still being searchable through the application code. I found a solution using the CipherSweet ...
mouad12300's user avatar
1 vote
1 answer
55 views

How to implement session-based rate limiting instead of IP-based for WordPress plugin? [closed]

I'm developing a WordPress plugin that provides chat functionality via REST API endpoints. Currently, I'm using IP-based rate limiting, but this causes issues in university/company environments where ...
user29255210's user avatar
Advice
0 votes
5 replies
72 views

Deploy Laravel version 12 (PHP, Inertia, ReactJS, Tailwind) to cPanel shared with no SSH Access

I have Laravel 12 project (PHP, Inertia, ReactJS and Tailwind) project that I need to deploy to a cPanel shared server. I do not have SSH access to the server, and the service provider does not give ...
Rootsman's user avatar
0 votes
0 answers
81 views

does database chunk() have a memory leak?

In laravel, I have a query that searches thousands of rows in a database, and I trying to compile that into a CSV file. In attempt to reduce memory usage, I get 500 rows at a time and output the CSV. ...
mankowitz's user avatar
  • 2,115
-2 votes
0 answers
48 views

How can I update multiple Elementor button links globally from one place in WordPress? [closed]

My site contains many download buttons (Elementor buttons) that all point to a .exe file download URL. I want to change the download link from one central place, and automatically update all download ...
Nicer Ata's user avatar
0 votes
0 answers
67 views

Retrieving values ​from 2 tables at the same time in CakePHP 3

I'm developing a small module on CakePHP 3 and I'm currently encountering a small problem that I can't seem to solve. I have two tables: Events and shop_ticket. Events table: I store information ...
user31931795's user avatar
-3 votes
2 answers
74 views

Changing product quantity in Stripe embedded components [closed]

I have successfully implemented Stripe using their Embedded Components API. As I understand correctly, for maximum security products are set server-site in advance. This absolutely makes sense for a ...
Ben's user avatar
  • 14
0 votes
1 answer
64 views

Laravel + Next.js show method

I know it's an unconventional pairing, but I am using Next.js and the Laravel stack for my app. namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\...
Felicity's user avatar
  • 177
1 vote
2 answers
102 views

Unable to generate slug with spatie laravel-sluggable

I'm not able to generate slug when seeding database. I'm creating an e-commerce website course, learning Laravel as a beginner. But no error about slug is provided. What should I do? Slug is not ...
Tomask's user avatar
  • 11
4 votes
1 answer
132 views

Problem with cron setting in Laravel 12 that is not working

I have a Laravel 12.39 project (on PHP 8.3) on a shared hosting with cPanel access, and in the cron section, I have the following setting to run artisan schedule:run, but it isn't working. This was an ...
McRui's user avatar
  • 2,021
-3 votes
1 answer
75 views

How to randomly show top 10 records from an XML feed? [closed]

Here in my WordPress plugin I am using the following Code to read an xml feed. $itsw_rss_feed = simplexml_load_file($itsw_feedurls[wp_rand(0,count($itsw_feedurls) - 1)]); then using a for loop I am ...
EMILY MARCIANO's user avatar
3 votes
1 answer
62 views

How to get the index of the wp-each directive in Interactivity API Wordpress?

I am learning the interactivity API, and when I tried the wp-each directive, I noticed that there is no way to get the index of the array. e.g., if this is my array $config = [ 'fruits' => [ ...
Reagan's user avatar
  • 2,672
1 vote
1 answer
59 views

Api Rest in CakePHP: How to return id fields (Bigint) as string and not as INT/BIGINT?

I created a REST API in CakePHP 4.5, and all the ID fields are of type Bigint. Is there a way to force CakePHP to convert these fields to strings before returning the JSON? There are many fields, and ...
Daniel Girardi's user avatar
0 votes
1 answer
105 views

Bug with @foreach loop in Laravel 12.x + Livewire 3.6

I am using Laravel v12 with Filament v4 and TailwindCSS v4. I wanted to build a site with tabs, witch are a Livewire component inside filament/Page. In this Livewire components I have 3 tabs, where ...
Keso's user avatar
  • 101
2 votes
1 answer
106 views

Using macros with dynamic name using dot operator does not work

While upgrading twig v1.30 to v3.22.0 i encountered some problem using macros from an external file and calling them by using a variable value as dynamic name. Given the twig file with the macros: {# ...
Olli's user avatar
  • 1,766
3 votes
1 answer
205 views

`docker-php-ext-install opcache` works with PHP 8.4 but not PHP 8.5 [closed]

I can build an image with this Dockerfile that is based on a lightweight Docker image that use Alpine: FROM php:8.4.15-cli-alpine RUN docker-php-ext-install opcache But I can’t build an image after ...
A.L's user avatar
  • 10.6k
0 votes
0 answers
57 views

Deploying a localized Laravel app using Dokku

I am using the laravel-localization package to localize my Laravel app. It works perfectly normal on local enviroment (using php artisan serve) and on shared hosting with Apache. I've just deployed it ...
Matic's user avatar
  • 45
Best practices
2 votes
3 replies
65 views

What is the license for reusing php.net code snippets from comments?

The php.net web site is full of comments showing code snippets/functions/small libraries. I was unable to find any mention on php.net regarding what license these snippets fall under, and a web ...
Raven's user avatar
  • 245
1 vote
0 answers
37 views

Show a success message after deletion from nova resource

<?php namespace App\Nova; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use Laravel\Nova\Actions\Action; use Laravel\Nova\Fields\ID; use Laravel\Nova\Http\Requests\NovaRequest; ...
Sourav Saha's user avatar
0 votes
1 answer
85 views

How to add routes in laravel 12 [closed]

Fresh new installation of Laravel 12 composer create-project --prefer-dist laravel/laravel api cd api composer update sudo chmod -R 775 storage sudo chown -R www-data:www-data storage sudo chmod -R ...
Kevin Waterson's user avatar
0 votes
0 answers
50 views

Why does Apple iCloud CalDAV always return 400/405 on PUT (creating events)? Is iCloud CalDAV write-protected?

I’m trying to create events on an iCloud Calendar using CalDAV. READ operations work: PROPFIND → OK REPORT (get events) → OK Authentication with app-specific password → OK But every PUT request (...
Ayoub Dakiri's user avatar
-1 votes
0 answers
60 views

VS code treats the address C://php.exe as h:/web/c:/php.exe [closed]

I installed the PHP Server extension for VS Code and added two lines to settings.json: "php.validate.executablePath": "С://php-server//php.exe", "phpserver.phpPath": &...
Andrianovi's user avatar
Tooling
0 votes
3 replies
61 views

laravel real time communication

I’m trying to implement a real-time notification system in my Laravel application. The frontend uses jQuery, and the backend uses Laravel’s broadcasting system with Reverb (also tried with Octane and ...
Mohammad Fazal's user avatar
0 votes
1 answer
65 views

Wordpress capabilities - give Editor the ability to replace the Site Logo?

I've created a custom Wordpress role to extend the capabilities of the Editor role. I want to give users the ability to change the site appearance as needed without providing full admin rights. The ...
unsquare's user avatar
-1 votes
1 answer
47 views

Problem with module during dolibarr update [closed]

I tried to update dolibarr from 16.0.3 up to the current version 20.0.2. So far it succeeded, but I do have an error code when I want to use a custom module for time-tracking. To me it seems that ...
tehomas's user avatar
  • 11
0 votes
0 answers
77 views

Vue/Laravel - CSRF token mismatch

on Vue-Laravel-based environment,CSRF token is initialized server-side -non-sanctum, one token per run-: routes/web.php Route::get('csrf-token' , function(){ $token = csrf_token(); return response()-...
Mahmoud Tarek Mahmoud's user avatar
2 votes
1 answer
57 views

Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works)

Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works) I'm working on a Symfony 7.3 project running on PHP 8.2. I recently migrated the database from ...
Juergen Schulze's user avatar
1 vote
1 answer
38 views

Elementor Repeater add item button text

Is there a way to change text in Add Item button for repeater? "Add Item" button text, Its a single button that adds new repeater item. I have muliple repeaters and I want each to have ...
Toniq's user avatar
  • 5,158
5 votes
1 answer
82 views

CloudKit Web Services Server-to-server Authentication failed using PHP

I've been trying to get the server to server request for quite some time, but unfortunately I keep getting this error: 2025-11-19T03:19:29Z:"mybody":/database/1/"mycontainer"/...
valentine's user avatar


1
2 3 4 5
29291