Skip to main content

PHP Collective

A collective where developers working with PHP can learn and connect about the open source scripting language.
1.5m Questions
+174
12.8k Members
+83
Contact

Pinned content

View all 3 collections

PHP admins have deemed these posts noteworthy.

Pinned
27 votes
7k views
Collection

Common Mistakes to Avoid in PHP

A list of real issues most beginners encounter when using PHP.
Sasha's user avatar
  • 101
Pinned
54 votes
4k views
2 minute read
How-to guide

Start learning PHP — Useful resources for beginners and advanced

Start learning PHP — Useful resources for beginners and advanced! If you're wondering where to start from learning the PHP language or needing some more knowledge to deep dive into the language, you ...
RB Projects's user avatar

Can you answer these questions?

View all unanswered questions

These questions still don't have an answer

0 votes
0 answers
4 views

The render() method takes a long time to execute Yii2

I just get a form with several fields. if in the controller method before return $this->render() I do echo 'Success!';exit;, then the page loads quickly. and when $this->render() is called, the ...
1 vote
0 answers
12 views

Problem with request in my react native app

I'm the newbie here and newbie in React and laravel (computer science student) I have problem with react native app. I have backend with api on WSL with Laravel.React native app on Windows 11. Problem ...
1 vote
0 answers
6 views

Laravel's ORM query using with() not working with paginate()

I am grabbing the related meetings with each Department, hence I would like to have a pagination for each meetings list. I currently have this in my Inertia Middleware to have it available in my ...
1 vote
0 answers
11 views

Multiple API Requests with ReactPHP

My Goals I am quite new to ReactPHP, async programming and software dev at all. I am currently working on an API that I want to make async. The API has to do massive amounts of API requests to ...
0 votes
0 answers
30 views

How to Display Related Custom Post Type on WooCommerce Single Product Page Using Custom Fields?

So, here’s the situation: I’m using WordPress, and within it, there’s a query I’ve created using the Code Snippet plugin. Plugins used: Product: WooCommerce Custom fields & custom posts: Secure ...

Looking for an extra challenge?

View all bountied questions

These questions have a bounty on them

0 votes
3 answers
144 views
+400

How to check status of uploaded inventory JSON to Amazon via (selling-partner-api sdk)

I am using the following SDK to work with the SP API. https://github.com/jlevers/selling-partner-api I am trying to upload inventory (stock) data. I believe it's done using the JSON you see me ...
0 votes
0 answers
91 views
+50

Is there a fix for "Option "--coverage" is ambiguous." in PestPHP in Bitbucket pipelines?

Running the custom test in the following configuration results in the message Option "--coverage" is ambiguous. followed by failure in the pipeline. image: name: timeglitchd/frankenphp-...

Learn something new
These are the most recent articles in PHP Collective
2 votes
105 views
2 minute read
How-to guide

Properly removing API from Laravel project

Sometimes a development team may decide to remove all API functionality from a Laravel project for various reasons, such as: No longer needing any API, and shifting focus to web application with ...
Yousha Aleayoub's user avatar
4 votes
150 views
4 minute read
Knowledge article

Understanding Mock Objects in PHPUnit Testing

When writing unit tests, a key challenge is ensuring that your tests focus on the code under test without interference from external systems or dependencies. This is where mock objects come into play ...
Al Amin's user avatar
  • 180
2 votes
91 views
2 minute read
Knowledge article

Understanding the final Keyword in PHP: Preventing Inheritance and Overriding

Introduction When working with Object-Oriented Programming (OOP) in PHP, controlling the inheritance of classes and methods is essential for maintaining stability and security in your code. PHP ...
Al Amin's user avatar
  • 180
9 votes
1k views
1 minute read
How-to guide

How to trim   (or non-breaking space) in PHP?

The main problem is the way trim() function works. One cannot reliably trim a substring using this function, because it takes its second argument as a collection of characters, each of which would be ...
Your Common Sense's user avatar
22 votes
57k views
3 minute read
Knowledge article

Evolution of Type Declarations in PHP

Introduction: PHP, being a dynamically typed language, traditionally allowed flexibility in variable types, providing both advantages and challenges in code maintenance and robustness. However, with ...
alkhatibdev's user avatar