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

learn more… | top users | synonyms

2
votes
1answer
103 views

Implementing Syncing between localStorage and SQL database?

I have made a simple web app, which runs completely offline - all data is saved in HTML5's localStorage. Now, I want the data to get synced with the server, so that the user is able to use the app on ...
0
votes
1answer
112 views

Commercial use for embedded system

I am developing a embedded system (computer + os + programs) to sell it to a company. I am confused about the licensing and the softwares I wanted to use to develop the system.So I want to know if I ...
-1
votes
1answer
111 views

Prevent 3D model from being copied [closed]

So I have been messing around with thingiview since I wanted to have a 3D viewer for the models on my site. It works great and everything except one problem. It's nothing wrong with thingiview, it is ...
2
votes
1answer
42 views

Building a DBAL from scratch

I am considering building a DBAL from scratch with PHP to use within my projects and also to learn through the process. I have noticed on SO and other reputable forums that whenever this is mentioned ...
-1
votes
1answer
80 views

gnu lesser general public license question [closed]

I have a question about Thingiviews license. I have a site that has to do with 3D Printing, it is not done yet but I was wondering if I would be able to use it on my site, The big reason I am asking ...
0
votes
0answers
40 views

User Generated Content and Hotlink Protection

I have a website that allows for users to paste content (like snippets of code, etc) for sharing. Like Pastebin and Github, I also have a "raw" link that will display the raw contents of those posts. ...
0
votes
0answers
26 views

Class/Object with different sets of configurations, singletons etc (PHP)

I want to produce maintainable code for configuring one or multiple classes differently depending whether in a production or development environment. For example, making a Paypal class/object that ...
0
votes
2answers
195 views

How can I handle Bots in a site that creates a database item every page

I have an eCommerce platform that creates a basket as soon as the user lands on the site if they don't already have one (from session or cookies). It then stores the basket information in session and ...
0
votes
1answer
82 views

Ensuring non conflicting components in a modular system

So lets say we are creating a simple "modular system" framework. The bare bones might be the user management. But we want things like the Page Manager, the Blog, the Image Gallery to all be ...
3
votes
4answers
379 views

Is it good practice to declare and set properties in abstract classes?

I am using PHP and designing some abstract classes. I can declare properties with constant values within my abstract class and access/overwrite them from any class which extends this without re ...
1
vote
2answers
104 views

Visitor only applicable when using the Composite pattern?

For a long time I've tried to get my head wrapped around the visitor pattern, and somehow this thing keeps being rather fuzzy to me. I'm currently under the impression it is only useful to apply ...
-4
votes
2answers
335 views

True/false on the left or the right? [duplicate]

I have heard that generally, an expression like: if (true === $variable) is faster than: if ($variable === true) My question is about the performance, not the readability. Questions such as this ...
0
votes
1answer
180 views

Implementing a strategy pattern with dependency injection

Okay, so the goal here is to implement a strategy pattern that can be tested using any sort of automated testing tool. I've been struggling with this problem conceptually for a few weeks now and I ...
1
vote
1answer
157 views

DDD - Business rule that depends on a service

I got confused about if a domain is required to access an external service in some state of it's life cycle. The business rule is this : If an Employee is accepting a JobSeeker's JobApplication, ...
0
votes
0answers
147 views

Use a global variable, a singleton, or something else

Preface: I am working in PHP (Abandon hope all ye who enter here). Background: There exists a large set of global functions in PHP, a number of which are miscellaneous system calls, like sleep (and ...
0
votes
1answer
91 views

New User Registration Logic [closed]

I am writing up a user registration application in PHP as part of my learning process. I have written up the general rules my code should follow. Please let me know what you guys think of it. Have ...
-4
votes
3answers
130 views

How to inherit from two parent classes [closed]

I have many classes with many relationship I draw Uml that relation between them: Is this relation true and how to implement this?
1
vote
1answer
78 views

Loosely compare user input with database record [closed]

I have a database table with 3 columns; id, question and answer. On the front-end, I have a PHP application that shows questions to the user. The application would then compare the user input with the ...
0
votes
1answer
47 views

Automating form error handling

I'm not sure if I'm being clever or making things more difficult. I'm working within a custom MVC framework, and within some of my "views" which contain forms I'm preserving input and styling errors ...
0
votes
0answers
116 views

API Client Design

I'm designing a client to the Tomtom WEBFLEET.connect API in PHP. (You can read more about the API through the full documentation here: ...
1
vote
2answers
154 views

Separating php and html code [closed]

What is the industrial practice on how to separate html and php code in a web project? Using echos to generate html is considered bad but what is the standard way to achieve the sought separation? ...
0
votes
1answer
426 views

Is a PHP array an example of a dynamic data structure?

I did my homework, and it says that dynamic data structures are "data structures that change in size as a program needs it to by allocating and de-allocating memory from the heap". So I was ...
-2
votes
2answers
189 views

Securing PHP source code from illegal copy [closed]

my IT boss asks what is the best way to secure the PHP source code against illegal copy of the code once it is deployed to clients. Is there a PHP compiler that will make the final codes unreadable? ...
1
vote
3answers
241 views

PHP coding practice [closed]

I'm a self taught PHP programmer. Because I have no formal training in PHP, I often find my coding style to be considerably different than example code I find on the Internet. I've slowly started ...
0
votes
1answer
65 views

testing: which code layers should I aim to test?

Say I have this code: Design { public function load() { $this->loadProduct(); $this->loadService(); ... } public function loadProduct() { ...
0
votes
1answer
157 views

Best practice for storing information from a php script for future use

My employer uses forms to help people search for products. The product lists can change from time to time and the forms need to be updated again. The product information can be accessed through a ...
-1
votes
4answers
202 views

Is Object Oriented Design necessary when building Symfony web apps? [closed]

I am primarily a software developer, and as such, I do a lot of reading on the subject of Object Oriented Design; the 5 SOLID principles, design patterns, composition over inheritance etc. I ...
0
votes
0answers
67 views

How should one handle accessing a 'local' API?

I'm currently writing a project that is using a few separate virtual machines for the database, API and front-end website (currently 1 of each). I'm writing my code in PHP, and all of these virtual ...
3
votes
1answer
128 views

Should a stored proc try to do more, in the attempt to avoid php mysql back and forth overhead

I have a REST architecture, running PHP on the server side which store and query a Mysql database. I am re-evaluating one architecture design decision: DECISION to re-evaluate: In an attempt to ...
0
votes
1answer
153 views

Is there a Pattern or a Refactoring Method to pull data-loading out of existing Class

I am refactoring legacy codebase. Part of it is a loadProduct() function inside a larger "everything" class. loadProduct() loads data from a database. I want to move this loading-data part out of ...
1
vote
3answers
233 views

Authentication with If/Else

For keeping the "Administration Panel" secure to those who are logged in, for my web application, is the best practice to use an If/Else Statement? if($_SESSION['logged_in'] == true) { include ...
1
vote
3answers
322 views

PHP Code base design: Single “queries.php” file, or spread queries across different php files/classes?

When I create PHP projects, is it better to put all database (e.g. MySql) queries in a single file (i.e. "queries.php")? Or is it better to place the respective queries in any "model" classes (i.e. ...
-1
votes
1answer
119 views

Building a webservice with mvc [closed]

I'am planning my website over here based on MVC. And I am thinking about a webservice (who knows, maybe one day I'll create an android app or something). The site and the webservice will behave ...
0
votes
2answers
195 views

mysql, store a single piece of data per row

I am preparing to write a database system using PHP and MYSQL which will store every piece of info sent to it as an individual row. Each row will store several piece of meta data (time stamp, who ...
3
votes
3answers
230 views

OOP what is meant by object-to-object communication

I've been reading in basic concepts of OOP,as i'm trying to make this shift from transactional scripts to more oop manner in php, and i often come across this definition : An object stores its ...
0
votes
2answers
152 views

Examples of designing a database that handles point tracking?

I'm attempting to expand my knowledge of how database designs and concepts work. I'm working on a hobby web/mobile app for practice that will challenge me. However, I am running into an issue. What ...
0
votes
1answer
212 views

How can I deal with a slow API in PHP?

I'm writing a public web app to get stock data from a magento store. I've accessed the data, but it turns out that i have to query each product individually for stock data. With thousands of items ...
6
votes
2answers
293 views

Slight extension for SQL prepared statements syntax. Need advice

In my database abstraction library I am extending SQL prepared statements syntax to hint a parser with expected literal type. I take it as a very essential improvement, my reasoning you can read here. ...
0
votes
1answer
228 views

I'm thinking to CSRF protect all public AJAX requests that return JSON, but I have some concerns

I'm thinking to CSRF protect all public AJAX requests that return JSON, because what's to prevent another site from spoofing the AJAX header and using the JSON as if it were a public API? I think CSRF ...
0
votes
2answers
128 views

Best design pattern for library with data model

I am refactoring an old Codeigniter library to be php framework agnostic. There are these core parts: the connection object - this will come from the "user"; ie, the framework's connection, or their ...
0
votes
0answers
79 views

Customizing configuration for PHP will Laravel 4 IoC be useful?

This topic has been discussed in this post: Customizing configuration with Dependency Injection However - I couldn't find one for PHP syntax and since one of the answers was to use a specific ASP.net ...
1
vote
1answer
327 views

Avoid code repetition in CRUD operations

I'm developing a PHP application and I find myself doing basically the same code for, say, creating an object based on a form filled by the user. The objects are of different classes, but the process ...
2
votes
3answers
319 views

Design for creating a menu based on user type

Problem I am building a PHP application which has a main menu, which in turn contains various "sections" or "subheadings" with various links. There are several user types such as SuperAdmin, Admin, ...
0
votes
1answer
47 views

Testing the Consumers of Subclassed Data Structures

PHP's SplQueue does not include a clear() or reset() function to wipe data out of the data structure. My application requires that functionality. This leaves two options: A) Create a subclass of ...
1
vote
1answer
147 views

Web design pattern

I am building a small website, in PHP and I am using MVC design pattern for the UI. In the future I will need to add mobile support for my website. It will be in the sub domain "m" like everyone. All ...
-2
votes
1answer
2k views

Advantages and disadvantages of PHP/Ruby [closed]

I've been a front-end developer for about two years now, and I'm attempting to break into the server side of things. Ideally I'd like to work for a startup social network on the back-end side so I ...
0
votes
1answer
751 views

Online and offline point of sales application [closed]

I am going to develop a simple Point of Sales system. Mainly all the data will be stored in a central db (mysql server). All the application are going to be winforms. Together each local client will ...
0
votes
0answers
59 views

etiquette for changing project style on php open source [duplicate]

Basically, there is an open source project on GitHub (php) that I want to fork and update to PHP FIPS standards (psr 0 to 4) and package for Composer on Packagist. I read a blog post a while ago that ...
5
votes
2answers
197 views

Branch twice for unique condition

Consider an application that displays only Foobars belonging to themselves to normal users, and all Foobars to admins: -- Normal users: SELECT * FROM Foobar WHERE user_id=:user_id; -- Admins: SELECT ...
0
votes
2answers
165 views

Is it better to use already build plugins/extensions or code your own in programming projects [duplicate]

I am building a web app in PHP and Symfony. Basically if we search there are plugins / extensions / bundles for almost 60% of stuff. The advantage of using them is that you can easily get your ...