Questions tagged [php]

Questions about PHP, a widely-used general-purpose scripting language that is especially suited for Web development.

Filter by
Sorted by
Tagged with
-1
votes
0answers
32 views

Should the coupling with a mediation layer be weak or strong?

There is a system A and B which should communicate, usually via an API from system to system. To Have no coupling between A and B (A should not have implicit knowlegde of what B needs to process and ...
3
votes
2answers
169 views

Is there a canonical definition of SPA - or is SPA a broadly agreed-on architecture with fuzzy edges? [closed]

Update: No. This question is not opinion-based. The question: "Is xyz an SPA?" is opinion-based. The question: "Is veSPA an SPA?" is opinion-based. The question: "Is there a ...
0
votes
4answers
238 views

Do all dynamically typed languages not support function overloading?

I have noticed that JavaScript and PHP and Python do not support function overloading. Do all dynamically typed languages not support function overloading? If the answer is yes, then why is that?
-3
votes
0answers
53 views

Why in java package names follow the convention that has this form: org.^something^.^rest_of_package_name^? [duplicate]

Both in my Android Java project and in Junit's documentation I noticed that package names follow the following convention: For example in junit4 there's the org.hamcrest prefix on each package name ...
2
votes
3answers
241 views

Is it best practice to always try to return a minimum number of rows from the database?

First-time poster so please be gentle :) I have a rather large table in my database (MySQL in case it matters) that holds lat/lng values of certain points of interest around the world (table name: ...
-2
votes
2answers
76 views

PHP Design Pattern, separation of concerns: should the Controller make a new HTTP request to the API?

I'm having a huge doubt on how to connect the front-end of my application to its back-end. So my application has a single entry point where all requests go. The request is dispatched to a controller, ...
-2
votes
0answers
24 views

Laravel - Naming of models, tables and controllers (when they are related)

I am currently building a system to manage my rental properties, and I am in a bit of a doubt when it comes to naming conventions... Suppose I have the below setup Properties (A property can have ...
-2
votes
0answers
26 views

Template builder app with placeholders and dynamic data rendering

I'm creating a service that's supposed to take field names from a user and then allow them to create a template like with a page builder. Then users will drag the available field keys to wherever they ...
0
votes
0answers
25 views

Third Party Data Push / Exchange Solution

Apologies in advance if this is the wrong StackExchange forum for this question. Looking for a recommended data exchange solution. Our application needs to push transaction data to a third party. Each ...
2
votes
2answers
117 views

Use old legacy application code from new application

If you have a big legacy application (big ball of mud), lets call it MudApp. If you then create a new application to make us of new technology and to make a new good looking frontend because that was ...
15
votes
6answers
5k views

Should I use DATE or VARCHAR in storing dates in MySQL?

Simply put, I have date and time attributes on an Orders table. The data types for these attributes are MySQL's DATE attribute. But everytime I echo the date and time in PHP it just gives me a string, ...
33
votes
9answers
8k views

Is it good practice to echo PHP code into inline JS?

I'm new to PHP and JS and I'm currently working on a gym management web app for our project in school. I'm adding a bit of QR functionality that sees if the user is eligible to enter the gym or not by ...
0
votes
0answers
53 views

Ajax with interval vs WebSocket

I am currently developing a script for real estate which tries to find a match between your products and your clients needs. So I need to give the user a notification whenever a match is found, I am ...
1
vote
1answer
104 views

In which layer should I load views on a Clean(ish) architecture?

I am trying to organize my architecture following the clean architecture while using some common practices/frameworks. I'm writing in PHP, but have no problem with other languages. The flow of my app ...
0
votes
0answers
20 views

Filter Gallery Images based on dropdown selection values

I currently making a "visual plan builder" with php-mysql, ajax and jquery Using multiple layers (z-index) I generate a visual plan with the following dropdown list values: Base Product - ...
1
vote
1answer
161 views

Is this correct adherence to Liskov Substitution Principle?

I used to have a base object with subtypes behaving in all but the same way -- the difference being in their render methods. This base class defined a default render method, overridden by Some ...
-2
votes
1answer
53 views

Authentication solution for custom PHP-based API

Here is description of my app I'm working on. On the client-side (index.html) a user can interact with a data. When he needs to call a server operation for example reading or writing a file on the ...
3
votes
3answers
292 views

Caching model objects to avoid multiple SQL commits

In decomposing a monolithic web application into smaller services and by following the Strangler Fig pattern, I'm in the middle of a problem for which I can't find a practical solution. There is a web ...
0
votes
0answers
22 views

Design pattern for duplicating lines of code in control structures [duplicate]

on my website I have a multi-page form where user can pass some data on each view, but user can also save a draft on specific step(in my example 1-4). My service has a dispatch method. Based on step(1-...
1
vote
4answers
199 views

Is having 3 return types for a function, in order to facilitate error handling a bad idea?

I have a function which returns either true/false, each return plays nicely with the function name: isOnline, however, there are cases in which I want to throw an error inside of it. Maybe the status ...
-1
votes
1answer
62 views

How to write package for two frameworks

I'm developing a package for Laravel & Lumen in the same code base, but I encountered some problems. Well, in the beginning, I thought it could have the same code and work for both frameworks, ...
2
votes
0answers
68 views

I'm trying to write something that will fill out an Australia Post Declaration Form [closed]

I've got basic proficiency in PHP, JavaScript, html, and SQL. I also use Postman little a bit. I hope a solution to my problem can be found within those skills, but I'm willing to learn a new language ...
0
votes
0answers
41 views

How to name multiple entities returned from a Query Handler?

I've got the following flow: HTTP API is exposing data from 2 database tables that are combined into one JSON structure. We're implementing this using CQRS - splitting the reads from multiple tables ...
-4
votes
1answer
59 views

How could I redefine a new type for subclass

I'm trying to represent some entity. LineProduct A line holding a quantity of product and a Product entity LineProductBlank A line holding a quantity of product and a ProductBlank entity Product ...
-8
votes
1answer
84 views

Are the stone-dead PHP mailing lists really how PHP developers and the PHP community communicate? [closed]

I've been looking at this for a long time: https://news-web.php.net/ Almost every single mailing list has the last messages sent to them in the year 2000-2003. That's 17-20 years ago! It would be an ...
55
votes
11answers
11k views

Is there a general solution to the problem of “sudden unexpected bursts of errors” in software?

Let me explain what I mean. I have made a complex, highly polished over years PHP framework/library for my own use. I very aggressively log the smallest notice and immediately deal with it as soon as ...
2
votes
0answers
164 views

How to handle a bunch of nested ValueObjects?

I'm writing a PHP web application (or actually a Symfony module). One part of it is a nested structure of ValueObjects (meaning: they are immutable and have to be validated on the creating). Such an ...
0
votes
2answers
168 views

For a very long lived PHP web application project, is custom (self made) framework better than (open source) popular frameworks?

For a project that's going to live/used/maintained by the developer for a very long time (ex: 20-50 year); Is custom (self made) framework better than (open source) popular frameworks? Basically my ...
-6
votes
1answer
81 views

What is the best option between buying, building from scratch or implementing an open source ERP? [closed]

I was required to do a medium ERP with the inventory, Bill of Materials, and production modules. However, I do not know how long it would take me. I am calculating three months for the analysis and ...
0
votes
1answer
100 views

Design leading to break contravariance. How to avoid it?

I have a Converter which use a Resolver to determine which Factory to use when converting a Resource to a Entity. To do so, I need to be sure that the Factory has a createFromResource method. The ...
-2
votes
1answer
54 views

Why does DateInterval lack weeks, quarters/seasons, as well as decimal/float versions of each property?

This has puzzled and frustrated me for years: https://www.php.net/manual/en/class.dateinterval.php y Number of years. m Number of months. d Number of days. h Number of hours. i ...
-2
votes
1answer
151 views

SOLID way to handle user input error (I18N & error context problematic)

Disclaimer : I come on this topic after it has been recommended to me on my previous closed SO topic (see closed one : https://stackoverflow.com/questions/64338968/how-to-effectively-manage-a-large-...
0
votes
1answer
138 views

DDD Aggregate in PHP — how to retrieve the root?

Status quo I created an aggregate, let's call it Foo. It has two entities within itself, let's call them Foo & Bar. You can mutate things by calling the aggregate's public methods. E.g. $foo->...
0
votes
2answers
91 views

How to effectively manage a large number of exceptions (I18N problematic) [duplicate]

I'm trying to found the best way to manage Exception for all over my application. Actually, I've come with two solutions : Solution 1 One Exception to govern them all. namespace App\Utils\Exception; ...
-1
votes
1answer
67 views

Setter dependency injection or locator pattern

Let's say that I have the following class. class Application { protected $dependency; public function setDependency($type) { $this->dependency = ServiceLocator->...
-4
votes
1answer
76 views

Create an e-commerce that integrates other store

I would like to create an e-commerce website that integrate other e-commerce. I can retrieve their products using APIs or feeds. The problem is that all these information are different from shop to ...
-2
votes
1answer
71 views

Does DigitalOcean offer enough resources to run a scalable MySQL cluster?

I have a kubernetes from DigitalOcean that has 2 worker nodes and 1 load balancer. Now I want to create a MySQL managed database cluster for the app that will run on that kubernetes. Question is: does ...
0
votes
4answers
231 views

An action in my controller has too much responsibility

(Disclaimer : I'm asking this question here because as it is opinion-based, it have been closed from https://stackoverflow.com/questions/64050308/an-action-in-my-controller-has-too-much-responsibility)...
-2
votes
1answer
129 views

First time teamwork (PHP): version control and continuous integration?

A colleague and I are going to be working together on a single project for the first time. This raises a few technical questions for me. Like how. I think a version control system is a must now, if it ...
0
votes
2answers
105 views

How can you avoid doing hundreds/thousands of queries when utilizing classes in PHP?

I have been dipping my toes into object orientated PHP programming and I'm finding it useful but I can't help but feel I'm missing something in regards to how to utilize it. Normally my classes and ...
-1
votes
2answers
173 views

Achieving server-side rendering of data coming from a PHP API

I have been working on a blog application with Codeigniter 3.1.8 and AngularJS v1.7.8. It is intended to be versatile and easy to use. The Dashboard of the application is "pure" Codeigniter, ...
0
votes
3answers
143 views

Should it be considered a BC break to return clone instead of new self?

(This question applies to the equivalent code in both Java and PHP) I have a class like this: class Foo { private int $bar; public function __construct(int $bar) { $this->bar = $...
1
vote
0answers
36 views

Best way to integrate google signin in existing user registration system with PHP/MYSQL [Logic]

I want to integrate google signin, in our existing user registration system. But not sure which approach will be good in terms of data security + user experience (UX) + speed. Even if its a good idea ...
-2
votes
1answer
46 views

Inheritance and domain-specific logic loses its independency?

Im sorry in forward, Im sure I wont be able to express myself well. Its a game system: abstract class GameType { private $score; public __constructor($score) { $this->score = $...
0
votes
0answers
19 views

Sanity Check Request on WordPress Problem involving Importing XML into Gravity Forms plugin

Disclaimer: This is a conceptual question and so I'm posting here rather than stackoverflow or wordpress.stackexchange Okay, so I need to import XML data into WordPress and parse it to populate a form ...
2
votes
1answer
215 views

Cross-cutting concerns and dependency injection

I've got a web application with an architecture somewhat like a front-controller MVC design. I get HTTP requests, route them, run them through a filter layer, dispatch them to my domain classes which ...
-2
votes
1answer
88 views

What are the names of the following patterns?

Two different patterns: Acting on a single object by multiple services that can modify it as they wish. So basically we would have some kind of a "chain" that modifies a single object by ...
2
votes
1answer
158 views

how to avoid / block e-commerce bots?

I am working in a big ecommerce platform from a very well known shoes brand here in my country, and our website have a page dedicated to a exclusive product This product sell just a few units, so by ...
-3
votes
1answer
70 views

Might be inheriting a php spagetti project. Full rewrite in different tech stack? [duplicate]

I'm in dire need of some help. My background is from python, js and ruby, with using frameworks to provide good structure. A potential client has an internal app which does quite a bit of stuff. This ...
0
votes
3answers
199 views

Is there an elegant way to structure consecutive short-circuited assignments?

The following code works and is clear, but it's also verbose. I suspect that there's a way to make it more terse, so that it could be skimmed quickly and it'd be more obvious what's happening. // The ...

1
2 3 4 5
41