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

learn more… | top users | synonyms

-4
votes
0answers
11 views

Customizing Wordpress theme

I just like Wordpress's home page of a particular theme. I want to build the rest of the site by myself. How feasible is this idea and do people normally do this?
0
votes
1answer
50 views

Saving an image in MYSQL vs saving to a folder

Is there an advantage to either method and/or a risk to either? Looking to upload JPG or PNG files only with a size limit of ~3mb with reduction done before insertion.
-2
votes
0answers
33 views

PHP: Classes with all static methods (using LSB for extending / overriding)? [on hold]

First off, I hope that this is the right place for this question. If it is not, please let me know where it should be posted. There is a debate going on within my development team as to what are the ...
0
votes
0answers
15 views

gearman or semaphore with symfony2

I want some way to store the user clicks on deals, categories and advertisements on symfony2 store. My situation: Basically, I am planning to use either messaging system using semaphore or integrate ...
-6
votes
0answers
32 views

Need advise on javascript and php [on hold]

I know this is off topic question and you may voted down. But i really need your advise on JavaScript JQuery and PHP. I always see this type of ads Need full stack developer on famous job sites. I'm ...
1
vote
1answer
53 views

How to compute Pricing of Product & Options based on User Option Selection and Pricing per Option

I am building a service for pricing options of a product and for pricing the product itself when product has various options. Example User selects some X options out of Y options available, where X ...
0
votes
0answers
29 views

Change API response with minimum code changes

My Application is built on Laravel and currently has the following components : Models Dictionary Word Controllers DictionaryController WordController It's a JSON API, so views are nothing ...
1
vote
0answers
57 views

How should I store usernames and passwords for user login using php/cassandra?

I am new to NOSQL and Cassandra. I am not sure if I should store usernames and password in Cassandra. If I should, what is the best way to do that? I am getting lots of conflicting ideas from ...
0
votes
1answer
70 views

Using PHP to grab an excerpt of contents in a file?

I want to grab a couple of paragraphs of one of my blogs and then contain a link to see more of it on my homepage which will take the user to the page with the whole blog. The way I do it is tedious ...
-1
votes
0answers
45 views

What classes should I use for API -> logic -> API?

I need to fetch some information from an API, parse through it and push the relevant data to another API. How should I design this? One class handling everything? One class per API and one for the ...
-6
votes
0answers
25 views

Can not redirect index.php file in codeigniter [closed]

I have created a sub domain, while I've tried to load page from, showing the below error message. But my actual domain working fine.
-4
votes
0answers
20 views

Database Structure for Agents commission payouts generation with TDS deduction [closed]

Actually I am creating this for the first time to generate the commission payouts for agents for their sale. Commission need to be generated when the product is sold out and payout need to be done ...
2
votes
1answer
69 views

Child class accessing its parent's method from Ancestor method

I find myself right now banging my head with the following issue (in PHP): I have an abstract base class, which has a non-abstract method, inherited and unchanged all over the inheritance chain ...
-4
votes
0answers
34 views

List aggregator web application [closed]

I was looking to build a small web app to list pictures by group (ex. fruits, animals, cakes, etc.). Then allowing each user to select from the various lists and create their own master list from the ...
3
votes
3answers
163 views

Unit Testing and 3rd party packages. Do I mock or not?

I'm just getting used to unit testing and on my new project I decided to adopt a TDD approach. My code below is to test the UserServices class which is responsible for creating a user, deleting a ...
1
vote
2answers
58 views

Does my code still break encapsulation and uses getters/setters instead of the TellDontAsk principle?

I and one guy have been discussing potential solution of a problem on an unrelated board, regarding the typical getter/setter hate, ie. using getters/setters leads to procedural programming. I ...
0
votes
1answer
110 views

Why use PDO's rowCount() if I can just use PHP's count()?

So in PHP, there's PDO to fetch things from a database. Now I see a bunch of $stmt->rowCount() calls in the code I'm working with. Why not just fetch the result array and throw a PHP count() over ...
-1
votes
0answers
20 views

grocery crud with codeigniter manage n-n realationship between three tables?

the database has four tables to implement cars features and values of this feature I create a trigger that adds all features to the table 'feature_has_value' after adding new car and give each ...
1
vote
1answer
59 views

Best practice for settings for PHP class for code generation [closed]

I would like to have a class create any code from given options and output it in a chosen way. Background I have written class for generation of simple JavaScript code for such cases where is needed ...
-2
votes
0answers
17 views

Accumulation Timestamp with Codeigniter and Grocery CRUD

I have questions because i'm tired to find my problem. my problem is a accumulation in codeigniter make plugin grocery crud. i'm can't accumulation with code : public function isp_management() { ...
0
votes
2answers
75 views

Undo/redo implementation for file changes in PHP

I was thinking to store all file operations inside an array, along with the reverse operations which are used for undos. Example: [ [ 'op' => 'move', 'parameters' => [$path_from, ...
2
votes
1answer
82 views

How far do I, or can I take TDD tests with Service Objects?

In writing PHPSPEC tests for a Zend Framework 2 application, I'm left wondering how far to 'dig'. Consider this very simple case: A DomainService (Domain in the URL sense of the word) should be ...
0
votes
1answer
124 views

Consuming REST services: client or server

I am working on a new project in which we are currently deciding which technologies and frameworks we will be using. The application will eventually be cross platform. Therefore, for the server side, ...
15
votes
3answers
4k views

Is it good practice to avoid warnings and notices?

I've generally been working with PHP warnings and notices off, since I work on a lot of projects where it's already in live production. Now, if I turn on the warnings and notices on these live ...
-1
votes
0answers
19 views

Store SQL queries in the database or in the server script? [duplicate]

I used to do queries from PHP by manually making a query string like "SELECT * FROM ... WHERE ... AND ...", but my office does it by making stored procedures in the database and just querying "CALL ...
0
votes
1answer
61 views

static method, helper function or in the controller, where does this go?

I'm working on a piece of functionality that simply allows a guest user to perform an action a certain number of times before requiring them to login\create account. In this instance, they can vote on ...
6
votes
6answers
239 views

Should I always store parsed data in database before manipulating?

I am about to start a new project which involves taking an excel file, parsing the data (php-excel-reader) and then using the parsed values in a HTML email. My question is pretty simple. Is it better ...
0
votes
1answer
170 views

Confusion over Node as a “script” vs Node as a “server”

As I was beginning to tool around a bit with node, I was told that I needed to undergo a little bit of a paradigm shift since I was coming from a PHP background. I would ask questions like, "I have my ...
0
votes
1answer
76 views

Strategy for Public / Private API, Encrypted (or Hashed) Data, and Server Compromise

In this very simplistic but realistic scenario, I have 2 combo web/database servers (A) behind a load balancer and a single IP address. They also permit access only from one IP address -- the client ...
5
votes
0answers
60 views

Algorithm to generate Edges and Vertexes outwards from origin with max multiplicity of 3

I am creating a 2d game for a website where the universe can grow extremely large (basically infinitely large). Initially, the universe is composed of 6 stars that are an equal distance from the ...
3
votes
2answers
149 views

How are POST/PUT/DELETE data passed to APIs?

I know that the data is passed through HTTP, but I'm not sure if I should be passing data through HTTP headers, or HTTP bodies. Which one is the convention for APIs? Also, theoretically using PHP, ...
3
votes
2answers
175 views

Implementing “buy one get one for free” coupon logic for shopping cart

Trying to solve bogo coupon logic with proper design pattern, but having trouble identifying one. Use case: "Buy iPad get SmartCase for free" Suppose we have the following objects: Product: - ...
2
votes
4answers
235 views

How to properly reverse the if statement when you have two conditions in it?

In PHP I have this if statement ( $first and $second will evaluate to true or false): if ($first && $second) { // evereything is OK } else { throw new Exception()... } My real code ...
3
votes
3answers
147 views

Are exceptions only for handling errors?

I have a script that throws exceptions when something goes wrong. However, for the purposes of testing I also want to capture specific points although I'm not sure whether they would be deemed errors ...
0
votes
1answer
187 views

Is PHP7 a static or dynamic typed language? [closed]

In the past few years, we've been using dynamically typed versions of PHP. However, in PHP7 we have an option to enable 'strict types': PHP RFC: Return Type Declarations PHP RFC: Scalar Type ...
0
votes
2answers
163 views

How to analyze a code of a web application which is running? [closed]

Joshua Bloch said in an interview that the best way to know and understand code written by others is to read it, mentally or through a debugger. Well, my question is this: is it possible, through a ...
0
votes
2answers
78 views

How to simulate method overloading in langs without such feature? [closed]

Langs like Java knows about true method overloading: class Overload { void demo (int a) { System.out.println ("a: " + a); } void demo (int a, int b) { System.out.println ("a and b: " + a ...
1
vote
0answers
101 views

Can this be used to implement Post Redirect Get pattern?

I am trying to implement proper a Post Redirect Get on a PHP site (question is language agnostic in nature however). I thought about it, and realized that running this code on every request seems to ...
0
votes
1answer
75 views

Why use PHP_AUTH_USER instead of taking credentials under post method

What would be the advantages of using PHP_AUTH_USER and PHP_AUTH_PW instead of the verifying the credentials under method - post . Why i should use: $_SERVER["PHP_AUTH_USER"]; and ...
1
vote
1answer
69 views

How can I create a client for a service without hiding the parameters needed for each endpoint?

I'm creating a client to a third-party soap web service in my application. Here is the way I'm thinking of doing it: Create a ClientFactory that makes a client based on the wsdl file, and sets ...
16
votes
2answers
1k views

Is it a good idea to define one big private function in a class to maintain valid state, that is, to update the object's data members?

Although in the code below a simple single item purchase in an e-commerce site is used, my general question is about updating all data members to keep an object's data in valid state at all times. I ...
2
votes
2answers
175 views

Is equating a variable to a function that takes the same variable bad programming?

Is it improper programming to set a variable equal to the result of a function that accepts the same variable? The languages in question here are c#, javascript and PHP (not sure if this works in C ...
3
votes
1answer
101 views

why use authentication token instead of session_id for app(android side) in REST API

in normal php web application after login we use session_id that came from web browser to check if user loged in or not. But in REST API authentication I read some tutorials that say php should send ...
2
votes
2answers
99 views

Best approach to develop php mysql project with multiple developers

We are 4 developers working on a PHP-mySQL web project. Currently we work together as described below: All project files except DB is hosted at GitHub All project files except DB is hosted at GitHub ...
6
votes
2answers
143 views

Advice for designing API request rate limiter?

I'm in the planning stages of a web application that makes heavy use of data retrieved from a third party's REST API. This data is cached on the server and requested by clients via AJAX. The REST API ...
0
votes
1answer
183 views

PHP framework advice needed [closed]

I started PHP programming around 2002, when there were not that many frameworks around. Over the years, I developed my own PHP framework, which seems to be entirely different from any standard I come ...
-2
votes
2answers
115 views

All methods in one file/class versus multiple files/classes [duplicate]

This question is mainly talking about PHP, but I think it can be applicable to other languages as well. This is a question about code organization. I have a friend who insists the best approach ...
-1
votes
2answers
118 views

What technique can I use to test my code when code renders out an untestable(?) PDF document?

I have a need to test output of my code before I send the output for PDF rendering. Currently I have decided on a switch statement that does two different things depending on whether I am in ...
0
votes
1answer
62 views

Abstract classes with static methods in PHP

Pre: I am looking at a quite big PHP project developed by a company which we need to partly interact with while building a new webapp. The whole application is developed in PHP 5. Most of the ...
0
votes
1answer
177 views

What is the name of this design pattern?

Magento has a class called Varien_Object with a pattern I'm trying to identify. The pattern creates hidden data and allows access to it but the main difference between this and a normal facade is ...