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

learn more… | top users | synonyms

0
votes
2answers
45 views

Return values for a delete function in php

I am writing a wrapper function for database calls, and I am confused about the best way to handle the error cases. The function has only one argument, the id of the object to be deleted. I've ...
0
votes
0answers
15 views

Dynamic Printing Options

I believe this is the correct community to post this question in, if not please point me to the correct one. Overview: Current web app gives users the ability to print labels from specific printers. ...
-1
votes
0answers
20 views

Shuffling of MCQ's in my examination portal

the screen shots attached are structure of database of my exam portal, one picture represents the question bank and second represents the test details.Test ID is acting as a primary and foreign key. ...
-1
votes
0answers
27 views

Principles for secure user login/authentication

Backstory: In my from-scratch PHP/MySQL web development projects, I often start (and end) working on a secure user authentication. I'm self-taught and never certain that my site is adequately ...
-3
votes
0answers
22 views

Mobile devices and their screen resolution [on hold]

I have used and if statement with document.write(screen.width + 'x' + screen.height); There must be a better way like knowing the type of device and then moving them to a custom website. Does ...
1
vote
2answers
163 views

where to put which code in MVC model

I recently picked up learning PHP and MySQL and I am trying to build a small usersystem as a coding exercise. While learning to use classes and functions, I also stumbled upon the MVC model and would ...
0
votes
1answer
54 views

Manipulating DOM via script or rebuild website - which is better?

Let's assume you want to change what user sees on the website. There are two ways to do that: a) manipulate the DOM via JavaScript, but user has to download whole script, with possibility he may not ...
2
votes
1answer
40 views

Where should view-specific data/logic be defined in a PHP MVC application?

After many hours of research and thinking I have found an understanding, then coming to question it again, I am struggling to find something concrete which I can grasp and apply to my code in a ...
0
votes
0answers
46 views

How to search through an array of objects?

I am using an array of objects to store data to render a page. A few examples of data an object can contain: PHP filepath for an include CSS filepath for CSS files Meta data of the page Element ...
-1
votes
0answers
42 views

How to send an email attachment from form using codeigniter

Can anyone help me about how to send an external file attachment directly from form type="file" through the mail using PHP Codeigniter.
-2
votes
0answers
47 views

How does one create a PHP page router controller?

I am making a PHP controller that should route pages on my website. It is my first attempt. Can someone revise this code and tell me if this makes sense or not. (never mind the logs array, I use it as ...
4
votes
2answers
606 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 ...
2
votes
0answers
86 views
+100

Symfony2 - Best aproach for a plugin system

Symfony2 is handling all its things in bundles in /app or in /vendor. This is fine, if you are handling and managing all by yourself or Ops that handle all needed things. But I haven't found a good ...
2
votes
2answers
95 views

Can a single Factory be used to create similar in purpose, but different in focus objects?

I am concerned about whether or not I am using FactoryMethod correctly. Background: I am refactoring legacy code and I have identified a pattern: there is a God Object that is created in memory,...
3
votes
1answer
273 views

Building dedicated codepad in PHP

I am author of growing framework, which is focused around User Interface building in PHP. Essential requirements for the up-coming website redesign is ability to run code examples. I am willing to ...
1
vote
1answer
110 views

Php-mysql injection

<?php error_reporting(E_ALL); //ini_set('display_errors', 1); $db_server = "localhost"; $db_name = "2"; $db_user = "root"; $db_passwd = ""; $connection = mysql_connect($db_server,$db_user,$...
0
votes
2answers
63 views

Reading the result of your command with the Command Pattern

I am currently looking into developing a new system utilizing hexagonal architecture and the commandpattern facilitated by a commandbus like tactician (it's a PHP system). Now I really like the idea ...
0
votes
1answer
260 views

Implementing SEO for a Zend Framework/PHP/Angular.js application

A team has implemented a web application using MySql, PHP with the Zend framework and Angular.js on the client side. I am in charge of implementing the SEO for this application. I understand I have ...
19
votes
12answers
7k views

How to write a command interpreter/parser?

Problem: Run commands in the form of a string. command example: /user/files/ list all; equivalent to: /user/files/ ls -la; another one: post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;" ...
0
votes
1answer
111 views

Using numeric arrays or associative arrays search and retrieve data ? [ file paths of a page]

I am building on a CMS where dependencies and files needed for a page get stored in the database. Because this can be very dynamic, I serialize these paths into one Database field into my pages table. ...
4
votes
3answers
1k views

How to deploy a single website to multiple physical servers?

Edit: I asked this question 3 or 4 years ago when I was new to web-development, the question looks a bit stupid to me today. I wanted to create a server setup of my own without relying on other ...
2
votes
2answers
201 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
1answer
462 views

How to bypass Oauth2 authentication when the client and resource owner is the same entity?

We are currently working on using an API provided by Mercado Libre which is a maket place for selling various goods. Their APIs use OAuth 2.0 for authentication. The problem is that OAuth 2.0 as ...
9
votes
7answers
3k views

Joomla or development from scratch? [closed]

As someone who has very little experience in it, I would like to know what makes you think that Joomla can fulfill all you requirements?. What makes you choose it over development from scratch (or ...
3
votes
2answers
255 views

Recommend an approach to decouple Product and Access code constructs, in order to simplify Product testing

I have some code that tightly couples Product specific code and Product-Access code. I am not sure how to untangle it. So for example, for testing Product, I have to mock up Access objects. And ...
0
votes
0answers
76 views

how to create triadic relations in laravel framework

I need to create triadic relation in laravel framework. Consider three models: Card, Notes, User. Card is related to notes and user, while they are related to each other. Now in models, when the ...
-1
votes
0answers
75 views

What does a framework need to be good? [closed]

So I didn't know what type of way to represent this question or where to post it, but I thought this would be a good place to start. So all current day frameworks have loads of features, loads of ...
1
vote
4answers
470 views

Do i have to make all my website PHP with embedded HTML to make a good secure website?

I see all websites (THE big ones) make both PHP and HTML in same page .. Do I need to make all my website pages as PHP and embedded HTML inside it ? Can't I make the website all as HTML Pages and PHP ...
2
votes
2answers
857 views

multi-language system and security with php

I'm coding a new site. İt's like StackExchange, a social site and a blog. I try to create a multi-language site, however I can't decide how to do it. I have to use modules, so I must use OOP, while ...
0
votes
1answer
40 views

Laravel Eloquent - Filtering results and eager loaded results

So here is the use case: You have users and they have many addresses. Say you want to filter and eager load on addresses (say...only US addresses). In order to do so you have to filter the eager load ...
-1
votes
0answers
55 views

Is it better still use Java\Spring MVC or a lighter technology as PHP\Laravel for a new project?

I am a Java EE developer that obtained the Spring Core certification (related to Spring Framework). In the last year I have gained experience with this framework. I am also pretty confident in the ...
3
votes
4answers
218 views

Multiple many to many relations or one option table?

Let's say I have a database of persons who have some properties. For the sake of this problem let's say all of these properties relate as N-N. I can either create two tables for each property (one ...
0
votes
0answers
32 views

Strategies to manage approvals of orders together with a log

Backgound I need to develop a system that handles orders that needs to be approved by supervisors (or users with more privileges). A log have to be implemented to show who created the order and when, ...
0
votes
1answer
132 views

Question(s) about PHP PDO connections

Let's say I have a Db class [ db.php ] : <?php class Db { // class properties private $db_driver = ''; // dsn credentials private $db_dhost = ''; private $...
2
votes
0answers
73 views

Are there downsides to writing PDO/mysqli statements into my code directly vs using my own redirect wrapper methods?

TL;DR: To access DB functionality in my codebase I currently use a custom layer throughout the code. The layer needs an upgrade in order to begin accepting prepared statements, which it currently ...
1
vote
1answer
126 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
1answer
3k views

Reporting Solution in PHP / CodeIgniter - Server side logic vs client side

I'm building a report for an end user. They would like to see a list of all widgets... but then also like to see widgets with missing attributes, like missing names, or missing size. So i was ...
1
vote
1answer
51 views

Accessing i18n objects from different scopes

I have been building a personal framework of mine which started off as a way to learn the MVC pattern and has progressed now into something that I like more than most frameworks out there (which is ...
0
votes
2answers
212 views

A few questions about model objects in a MVC

I have a few questions about how to implement models and what the results are of those implementations: When I only need a few variables set, isn't it memory consuming to create an entire object? E....
1
vote
1answer
73 views

How to display recent post on website and make own search engine ? With PHP

On OLX like Website , Anytime a user posts a new ad. It comes in top of the page. No search is involved in it. Which technology we can use to make such functions. Suppose X is visiting my website ...
48
votes
4answers
88k views

How can I test PHP skills in a interview? [closed]

My company needs to hire a PHP developer, but nobody has PHP knowledge in my company and we find difficult to test for PHP skills. If it were a C/Java developer I would ask him to write a quick ...
0
votes
0answers
48 views

How should i handle deeply nested data with codeigniter/mvc?

I want to build a website with categories, pages, sections and slides. Hierarchically it should look something like this: [category 1] [page 1] [section 1] [slide 1] ...
2
votes
1answer
198 views

Explain ServiceLocator pattern of ZF2

I am looking at this example: http://framework.zend.com/manual/current/en/user-guide/database-and-models.html Relevant excerpt from above: class AlbumController { public function getAlbumTable()...
0
votes
1answer
406 views

Should I use session or cache to keep the time it last polled when polling to server at intervals?

I'm building a web chat app using session to keep the time the app last polled so that the server can determine whether messages exist between the current polling time and last polling time. It works ...
2
votes
3answers
167 views

How to gently steer a giant PHP app toward better practices? [duplicate]

So I'm responsible for maintaining and enhancing a PHP codebase that runs to around 1,100 files and 120,000 lines of code. In general, it's not terrible, although since it was written over some 10+ ...
-1
votes
2answers
123 views

The best way to create a PHP chat system

I'm into creating a php based web chatting system. About 1000 concurrent users across the world will be using it, so what would be the best tech to deploy? As I did some research online, mainly I ...
3
votes
1answer
167 views

Dependency Injection & In-class Instantiation | Practical Limitations

Dependency Inversion is Good Inversion of dependency is good, it: Simplifies unit-testing Reduces coupling, allowing software components to be used interchangeably Keeps instantiation logic for a ...
0
votes
3answers
545 views

How do I handle 3rd party search result data (via cache)

I have a search function on my site and it is taking data from 6 different 3rd party resources. The problem is, it takes too long requesting the data over and over again on the results page. I've ...