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

learn more… | top users | synonyms

0
votes
0answers
47 views

Laravel 4: Binding/linking two users together

I'm building a unittest system. At some point I want to bind two users together in order to make an assignment for those two. So when the admin chooses to link two students together the system should ...
0
votes
0answers
37 views

Writing Models in PyroCMS/Codeinighter Models

In Pyrocms there are Admin views and User views. Im developing a complex module where my model file is getting to be rather large. Should I be abstracting logic in my model files to also be User ...
0
votes
2answers
198 views

Flaws in my PHP development setup - sharing sources causing lags

I have following development setup for my PHP projects: Working station running on Windows 7 with PhpStorm IDE. GIT for version controlling. CentOS on virtual machine (VirtualBox) with Apache and ...
0
votes
2answers
170 views

Failed to allocate memory - What is it trying to say?

In my early days of programming I often used to get memory related fatal errors in the following format: Fatal error: Allowed memory size of <some big number> bytes exhausted (tried to ...
1
vote
1answer
1k views

Face Recognition(OpenCV) with MySQL and PHP

First of all I have asked this question on stackoverflow and got down vote for question being not belonging to the site. I am trying my luck se now(more suitable to se I guess) and I hope I will not ...
1
vote
1answer
253 views

Advice on refactoring PHP Project

I have a small SAS ERP that was written some years ago using PHP. At that time, it didn't use any framework, but the code isn't a mess. Nowadays, the project grows and I’m now working with 3 more ...
7
votes
1answer
175 views

Securely sending data from shared hosted PHP script to local MSSQL

I'm trying to add data from a webhook (from a web cart) to a local Microsoft SQL Server. It seems like the best route for me is to use a PHP script to listen for new data (POST as json), parse it, ...
2
votes
1answer
83 views

Do objects maintain identity under all non-cloning conditions in PHP?

PHP 5.5 I'm doing a bunch of passing around of objects with the assumption that they will all maintain their identities - that any changes made to their states from inside other objects' methods will ...
1
vote
1answer
33 views

Correct process for creating builds reliant on 3rd party packages

I work on a Symfony 2 codebase. We use a number of third-party packages (most are in the Symfony Standard Edition). We use composer for dependencies. We current have all of our third-party code ...
0
votes
1answer
181 views

Penny auction concept and how the timer works

I am creating a penny auction site using PHP yii framework. The main consideration of the system is to update the database records of all active auctions (max 15 auctions) with the current ticker ...
0
votes
1answer
189 views

Website File and Folder Structure

I am having a problem learning how proper website structure should be. And by that I mean how to code the pages and how folder structure should be. Currently I am navigating around my website using ...
0
votes
1answer
82 views

exception for string literal conventions

If I'm used to use ' for string literals in PHP, would it be better if I'll stick to it in any situation or can there be exceptions when it would increase readability? example: $foo = "bar'baz"; // ...
0
votes
0answers
93 views

ffmpeg: cut multiple input files with seeking to one output file

I have list of video files (loaded from database), each with start and end time of requested interval: # file begin end v1.mp4 1:01 2:01 v2.mp4 3:02 3:32 v3.mp4 2:03 5:23 And ...
0
votes
2answers
365 views

Why elseif instead of else if?

Few days ago I stopped on some PHP's developers quide (for contributors to particular project) and it stated, that elseif must be strictly used instead of else if -- without giving any reason, why? ...
0
votes
2answers
125 views

Image caching when rendering the same images on different pages [closed]

I'm told to think about caching of images that will be displayed on the page. The images will be repeated throughout the website on different pages and I'm told to figure out the best way to cache ...
1
vote
0answers
140 views

Websockets VS SSE

Suppose I have a service which requires to seek the database for different data once and in a while. For this I have 2 or 3 SSE, each one with a different retry basetime (20000 miliseconds, 1000 ...
0
votes
1answer
237 views

Should I use my own public API on my site (via JS)?

First of all, this question is far more different other 'public api questions' like this: Should a website use its own public API?, second, sorry for my English. You can find the question summarized ...
1
vote
1answer
103 views

How to properly handle conditional dependencies in a factory?

Let's say you have a string $action run-time, that specifies which type of $object needs to be created: $dbobject, $memcacheobject, $fileobject, $xmlobject, etc. Assume also, that creation of an ...
1
vote
2answers
1k views

Should you use PHP to render the html page or use javascript frameworks? Server-side page rendering or client-side page rendering? [closed]

This may be a inappropriate question, but I'm really need help demystifying this. Suppose we want to create web application like reddit or Gmail. The way I understood it from my research is that ...
0
votes
1answer
98 views

Javascript based application controller in Javascript-less environments

I just got done watching an informative Box tech talk by Nicholas Zakas on a javascript architecture for web development: https://www.youtube.com/watch?v=mKouqShWI4o&feature=youtu.be This image, ...
0
votes
1answer
205 views

Applying DDD to a simple app with a configuration twist

I’m using the light-weight PHP Fat-Free Framework as a base to form a simple MVC based app with DDD philosophy for the Model layer. I’m aware that DDD is most suitable or enterprise solutions and that ...
0
votes
1answer
192 views

What is the proper way to extract and pass parameters to call javascript functionality from my PHP page?

This is my situation: I have a search results page in PHP where most of the logic resides in a javascript file in order to avoid refreshing the page every time an action is performed. The first thing ...
0
votes
1answer
112 views

How do you detect lying Stubs/Mocks?

Consider this piece of code from the PHPUnit manual(I'm using PHP only as an example): class StubTest extends PHPUnit_Framework_TestCase { public function testStub() { // Create a ...
0
votes
0answers
39 views

Is there just one EventHandler class per application?

In a game I'm making I was about to add a MovementEventHandler, with events like "pre-character-movement" and "post-character-movement". But this class will do exactly the same as a future ...
0
votes
1answer
55 views

Restricting object types that can be added to each other using the Composite Pattern

The Situation: I am building a custom PHP application framework. I have implemented a composite pattern so I can build a object tree representing the page to be rendered. Example: abstract class ...
0
votes
1answer
261 views

Many-to-many in OOP: Class A instantiates Class B, which instantiates Class A, which

I am mapping Field1 to Field2. The map object instantiates the field object and vice versa, creating an infinite loop. This is in PHP. class field { protected $maps; // mapCollection object. all ...
2
votes
0answers
101 views

How to build child classes as parent configuration?

I'm using Codeigniter PHP Framework for developing a web application, and when developing an admin zone, I've ended building a generic parent class called AdminController which is extended by the ...
1
vote
0answers
185 views

How to authenticate user on php and Node.js

I´m currently developing a little chat page. The main page and user management is written in php and also all the authentication stuff with sessions. Now I´m planning to run the messaging stuff on a ...
0
votes
4answers
4k views

How to insert/update a large amount of data into mysql using php

I have an excel sheet which has a large amount of data. I am using php to insert the data into mysql server. I have two problems 1) I have to update a row if the id already exists, else insert the ...
1
vote
3answers
139 views

Reason to treat internal class variables and functions inside a class as “separate” entities

Note: there is a similar question that addresses my subject: Better style for member variables? ... but that question does not address "dealing with large legacy code base and comprehension of ...
0
votes
2answers
113 views

How should I create object after database insert PHP

I have just been working on a new project and doing things the same way I have for years now. However for the first time, I am constantly thinking about scalability and performance of both the ...
1
vote
1answer
118 views

Use Generic of Specific Function names for similar objects

Is there a school of thought on putting focus on using generic names for functions, opposed to naming functions based on the things they do? Example Say we have a Bill / Price Sheet object, that has ...
0
votes
1answer
77 views

What concrete steps can I take to assess PHP framework(s) without having to go to the extent of getting to know each framework in intimate detail?

This question is about what methodology to follow when evaluating one or more PHP frameworks to see which one would suit the needs of my project best. In other words, given the time pressures that ...
1
vote
2answers
219 views

How to refactor code that has 2 concerns

Say I have this code: if ($this->ship == "e") { $this->price->addLine($this->price->base * $this->price->e, 0, "Export"); ...
-2
votes
1answer
159 views

Develop a website using mustache.js and PHP [closed]

I'm thinking of building a website using mustache.js to render the website and having PHP as the backend. The PHP will then mainly contain queries to the database and some SESSION checkings. ...
2
votes
1answer
170 views

Interface hierarchy design for separate domains

There are businesses and people. People could be liked and businesses could be commented on: class Like class Comment class Person implements iLikeTarget class Business implements iCommentTarget ...
0
votes
0answers
35 views

How to unit-test for PHP implicit conversion errors?

Is there a way to find errors caused by crafted input in php, such as naming POST-fields like variable[] instead of variable, causing PHP to implicitly convert it into an array, by using some form of ...
1
vote
2answers
128 views

How should I connect to my php framework to use methods written in the framework, in a framework agnostic environment?

My company runs 2 websites, a public facing website for clients, and an employee intranet. The intranet is used as a backend for employees to edit and maintain various parts of the public website. ...
-3
votes
3answers
1k views

How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to ...
2
votes
2answers
162 views

variable overwriting in PHP

For example I have this code: $route = 'product/category'; //variable overload $type = explode('/',$route); $type = $type[1]; My thinking behind this is that I actually don't need unique ...
0
votes
2answers
776 views

Large MySQL Batch Inserts From PHP: Run insert from script, or save as SQL file?

We have a large dataset that's current residing in many, many spreadsheets. I've been tasked with getting part of that data into our MySQL DB. When all is said and done, I will probably be inserting ...
0
votes
1answer
68 views

Persist AJAX values [closed]

I have a simulator that pulls data from a DB - calculates and return JSON result to an ajax call that renders a table for the results. The calculation procedure are as follow: grab X number of data ...
1
vote
3answers
252 views

Exception when logging exception: is it correct to ignore them?

My question is specific to php, but i think it can be useful in other languages. I log into a table all the exception a code can throw: try{ //Some code } catch (Exception $e) { $log = new ...
1
vote
0answers
116 views

Writing a PHP wrapper for Javascript to safely access REST API

I am looking for signposting help to secure my API keys when accessing a database over REST API from Javascript on a webpage. I have read that in order to secure the API key I need to create a wrapper ...
1
vote
2answers
96 views

Dependency injection for request variables in a web application

I'm working a PHP 5.5/MySQL web application. If a class depends partly on some global GET and POST variables for its members, should I just refer to them directly from within the class, or should I ...
0
votes
6answers
3k views

Combining two MVC frameworks in a project

Is it any good to combine two MVC frameworks together in a project? Is it a fairly common approach? I am thinking about using a serverside framework like CodeIgniter/Laravel and client side framework ...
2
votes
1answer
194 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
206 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
147 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
78 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 ...