Questions about PHP, a widely-used general-purpose scripting language that is especially suited for Web development.
1
vote
0answers
82 views
Are facilities that generate HTML for you, considered harmful? [on hold]
I will approach this from two directions (+ raw HTML itself being de-facto third)
Proprietary HTML-generating code
Code generating facilities provided by a popular library
Proprietary ...
-4
votes
0answers
24 views
PHPRunner-like development with? [on hold]
Would frameworks like Django or Flask yield themselves to making web apps like the ones that PHPRunner makes? The main difference I see in PHPRunner web apps and other frameworks seems to be that the ...
1
vote
1answer
63 views
Synchronize database with external API
I currently own a website where players can look-up their statistics of a game. When someone that is not in my database yet requests their statistics, I am calling the API with a PHP cURL request and ...
-5
votes
0answers
43 views
How To Develop A Commenting System [on hold]
Hello programmers i need the coding of commenting system in which a user can also reply to the comments i tried to make a commenting system like in the pic but failed to make it if anyone can provide ...
-3
votes
0answers
27 views
Wordpress write plugin to process payment inline [on hold]
I need to write a plugin that takes payment for a donation right on the
"product" page. We have Woocommerce and the Elavon (with Converge gateway) plugin installed. This works great for adding a ...
0
votes
0answers
31 views
Confusion on storing favicons [on hold]
I have a self hosted web application where we can add multiple web sites. then i need to show theirs favicons.
Currently i'm using https://plus.google.com/_/favicon?domain=google.org to show favicon. ...
-4
votes
2answers
45 views
In a client-server application, which part is the best to start with? [closed]
I am going to start working on a client-server Android application, the client side will be coded using Java and Android SDK, while the server side will be programmed using PHP .
Assuming that I've ...
-2
votes
0answers
26 views
Beginner php Coding error [migrated]
I'm coding in PHP as a beginner. Apache is running via xampp. I place this code below in a .php file inside htdocs folder, but when I execute, it failed and showed this:
Hello, World! I'm testing
...
-4
votes
0answers
22 views
I'm trying to get a fixed image size for every random image [closed]
I have this script where it chooses a random image and displays it on a webpage. I want it to display every random image the same size.
The site is mmmemes.com when you hit continue it changes images, ...
1
vote
0answers
32 views
Storing reference to a model obtained using DataMapper to be able to call save on it
When using the DataMapper pattern, which involves modeling classes containing business logic and knowing absolutely nothing about persistence, caching,... I usually want the models to represent ...
-5
votes
0answers
37 views
Best scripting languages for web based GUI w/ database? [closed]
I'm creating an item builder webapp for League of Legends and before I just default to what I'm familiar with (JavaScript/PHP) I want to know if there are better tools for the job.
It will need to:
...
0
votes
0answers
35 views
Recursive(?) algorithm design help
I have a requirement to allow my end users to input formula much like a spreadsheet. I have an array like this:
$table = array(
1=>array(
"id"=>1,
...
0
votes
2answers
38 views
What to use htmlentities/strip_tags/mysqli_real_escape_string? [closed]
I have a code to insert data in db but the body element stores p tags in it's column, so i used strip_tags to get rid of it. Now although it's working fine but I want to know what to use for best ...
0
votes
1answer
56 views
Are hooks really subsumed by Slim Framework middleware?
I've been using the Slim Framework (v2) for a little while now to develop my user management system.
They recently released Slim 3, and according to the upgrade guide,
Slim v3 no longer has the ...
0
votes
1answer
75 views
Thoughts on a “key adapter” [closed]
I just had an idea that seems like a great one at first but then when I think about it there is no way that anyone hasn't thought of it before me and the fact that I haven't seen it implemented ...
2
votes
0answers
117 views
Why do some top projects require write permission on code itself? [closed]
Well this could be a very wide question as every project have different philosophies. But meanwhile question is that We have lot of projects like Yii, Drupal, Apigility which requires full write ...
1
vote
1answer
42 views
Access container object from within an item
Generally I have 3 classes, a container that holds an array of items and a special object that is another property of the container class. What I need to do is access the special object from an item ...
2
votes
0answers
38 views
Where to output from large CLI app [closed]
I've built a reasonably sized CLI app with everything split across different classes and namespaces in a logical way. However many components need to render output from within themselves. Which seems ...
2
votes
2answers
89 views
How to accomplish a task of evaluating editable variables and formulas, using PHP?
Task as defined:
User needs to be able to define their own variables and formulas to operate on those variables, to get output based on their inputs. Since formulas and variables and their inputs ...
2
votes
0answers
37 views
Standard for order of tags in PHP DocBlocks?
Based on the tags listed from this "standard", is there an order of the tags that people typically follow? Even if it's not something that has been entirely accepted, but something proposed? I am ...
0
votes
1answer
59 views
PHP MySQL unique user data [closed]
I'm trying to create a php website that users log into and they can submit data to a MySQL database. How do I make it so the users can only see data they've submitted and not everyone else's data?
...
0
votes
0answers
51 views
Correct way of running methods from frontend in an OOP framework
If I have a link to change language of my website, where should that link lead in order to execute a PHP command, specifically in Codeigniter framework?
I am interested in the most recommended, DRY ...
0
votes
0answers
28 views
Test for PHP Errors using Browser Emulator (Mink)
I want to know the most robust way of checking for PHP error messages when running automated tests that interact with a PHP application via a browser emulator.
The reason is: I use Behat, Mink and ...
4
votes
2answers
156 views
Is trait composition an good practice?
So, I am now dealing with this relatively new codebase which uses, and sometimes feels like it abuses traits. Since I have been exposed to trait usage in a rather limited fashion, I was wondering ...
1
vote
1answer
47 views
Storing PageViews Count Data in MongoDB
I would like to ask for feedback for some programming logic concept & ideas. I am building a site where i would like to keep track on how many pageviews a page has daily. I have thought of 2 ways ...
2
votes
0answers
57 views
PHP Vertical Columns from 3 SQL Tables
I work at a high needs school in which there are several classes that plan their work through Excel spread sheets grading and tracking student progress. We have come to the conclusion that this ...
3
votes
1answer
138 views
How do SQL transactions return immediate results?
I am using transactions to do bulk insert/updates. This is my little test loop:
$now = date('Y-m-d H:i:s');
for ($i=0; $i<60; $i++) {
$db->insert($cfg['ps_manufacturer'], array(
...
2
votes
5answers
159 views
Inheritance when following the Repository Pattern in PHP
I am trying to build a PHP application using the Repository Pattern but I'm not sure how I should implement the save method.
I have an abstract class called ItemRepository which have the following ...
0
votes
1answer
57 views
When is the best time to compute rating changes in a PHP application?
Imagine a simple PHP application where an user can post notes and the other users can upvote or downvote them.
We want to implement a system where each note has a different rating (normal, good, ...
-2
votes
0answers
17 views
Saving time on mysql as data [migrated]
I want to save date and time on my mysql database and then want to show them in my webpage's comment box. But writing the following code, my database saving time as 00:00:00 at 00:00 and in the ...
0
votes
2answers
72 views
read file bytewise and find information
i am a hobby php-dev and have the following problem:
i have a rar-file, whose header is damaged, therefor extracting is not fully possible. the contents are non-compressed, and can be read with eg. a ...
0
votes
3answers
161 views
call function once again after failure, without duplicate lines?
I have what is probably an over-engineering question. I have some PHP code that logs messages to a file. We've been having a problem with the file having the wrong perms from time to time. While we're ...
7
votes
1answer
147 views
PHP: when to use arrays, and when to use objects for mostly-data-storing code constructs?
PHP is a mixed paradigm language, allowing to use and return non-object data types, such as arrays. I pose a question to try to clarify some guidelines for selection of arrays vs objects when deciding ...
1
vote
2answers
92 views
Alternatives to cron jobs or other ways of improving scheduled task performance
I'm working on a social networking website where users gain ratings after specific actions taken and proper conditions are met on the tables. The ratings are calculated depending on 'total hours ...
-2
votes
0answers
14 views
How do I remove the dot using isDot() using RecursiveDirectoryIterator? [migrated]
I have this simple below code to help me get the contents of all files and sub folder. I took this code from the PHP cook book. it says that I can use the isDot() but it doesn't explain how to ..
I ...
0
votes
2answers
300 views
How are complex programs made? [duplicate]
I know a few languages, and can program in them. How do multiple languages blend together in a single program? For ex. https://github.com/facebook/watchman. This uses C, PHP, Python, Javascript, etc. ...
0
votes
1answer
89 views
What is the problem will happen if I create auto generate ID without using mysql auto increase of mysql table by my self?
I would like to ask you a question about MySQL AUTO_INCREMENT.
I already created my own function to generate AUTO_INCREMENT when the user inserts any data input a table in MySQL. This function works ...
2
votes
2answers
56 views
How can I keep data integrity across multiple services in a transaction-like fashion with PHP? [duplicate]
I find the concept of transactions really useful when working with databases because obviously it allows you to rollback changes if one step of a modification goes awry.
Is there some way I can ...
6
votes
1answer
152 views
Clean Architecture - How to go from “Database Driven” to “Independent of Database” [closed]
I am looking for some clarity and hopefully some advice on writing clean architecture for a large system. My Companies "Web Solution" is +-10 years old, my job is to rewrite it. It is written across a ...
2
votes
2answers
136 views
Is it a good idea to modify the array keys in foreach
First let me say that i am talking about PHP, but the question is a general one. Some times i need to modify an array key for example something like:
$temp = array();
foreach($arrayIWantToModify as ...
5
votes
2answers
125 views
Designing a ticketing system where the User and Administrator have similar but different functionality
I am designing a simple ticketing system in Laravel 4. The system will simply allow a User to create a ticket, and an Administrator to answer it.
The User will be able to:
View a list of his ...
11
votes
2answers
724 views
DRY principle in good practices?
I am trying to follow the DRY principle in my programming as hard as I can. Recently I have been learning design patterns in OOP and I have ended up repeating myself quite a bunch.
I have created a ...
4
votes
1answer
58 views
Should domain model be intelligent or there must be services, which operate it?
I'm building a web-app for a licensing service. My domain models are Licenses, and they can be of two types at the moment: server and client license. They are almost same, except server license has ...
8
votes
3answers
225 views
Cross-language Test-Driven Development
The short question: How do you follow Test-Driven Development on a project that spans multiple languages?
Specifically, I'm writing a web application that uses JavaScript and PHP, and I want to ...
2
votes
2answers
193 views
matching usernames with their password
We are working on a simple login/registration form. Our login script checks to see if the username and password exist in the same row of the database. If it does exist, we bring the user to a welcome ...
2
votes
1answer
75 views
For DI, where to create dependencies (new objects) specifically within framework code?
Basic requirement
I'm making a framework for learning purposes (and likely usage on personal sites).
I'm using dependency injection in classes and I'm trying to design where would be a good place ...
34
votes
7answers
4k views
Is there a need to keep tests for simple (self-contained) functions?
Consider this:
public function polynominal($a, $b, $c, $d)
{
return $a * pow($x, 3) + $b * pow($x, 2) + $c * $x + $d;
}
Suppose you write various tests for the above function and prove to ...
5
votes
2answers
193 views
Persisting Large/Complex Entities with the Command Pattern — Am I doing it right?
I am in the process of designing and building a large-scale inventory management software-as-a-service that will, hopefully, live a long and fruitful life. Therefore I am exerting a lot of effort ...
1
vote
2answers
184 views
Purpose of encrypted product ID/key in shopping carts
I'm a newbie for PHP ecommerce applications. For my academic activities, I need to complete a shopping cart system with basic shopping cart functions. I have studied several apps which are already ...
1
vote
0answers
121 views
How safe is returning a password from a function? [duplicate]
Is returning sensitive data like a password from a function safe, and what attack vectors exist?
(Personally, it is regarding PHP, but is a general question.)
function returnDBPass(){
...