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
9 views

Developing custom elearning site using php frameworks [on hold]

I want to develop a custom elearning site using a php framework such as Symfony, WordPress, Yii ,... . Kindly let me know which php framework do you suggest? Thanks
-2
votes
0answers
12 views

Connecting Javascript and PHP

I wanted to do extreme security but the problem is ... using PHP. It seems there is too much php code. Is there any way to use javascript's function on user's input? Wont using php too much slow it ...
-3
votes
0answers
9 views

Listing all the PHP and MySql PDO features, like a guide [on hold]

The information is so diverse that it really gets confusing to just search it. So, I would please ask for PHP and MYSQL PDO functions(IMPORTANT)/EXPERIENCE methods and functions of doing PDO. This ...
0
votes
0answers
10 views

How to design DataMapper for table with composite primary key?

Normally I would have a UserMapper that handles a table with a primary key with the following methods: findAll() findByIdentifier($identifier) findByEmail($email) But how would it be for mappers ...
0
votes
1answer
100 views

PHP as a target language [on hold]

Are there stable well tested SDKs (as opposed to simple language converters) that allow you to develop your application in some decent language (I believe it is widely accepted that PHP is not a well ...
-4
votes
0answers
25 views

Not able to dynamically pull data from a table into a drop-down select field [on hold]

Here is the function to fetch data from the City or State table. City table contains 3 columns (city_id, city_name, city_desc). State table contains 3 columns as well (state_id, state_name, ...
0
votes
0answers
54 views

The finer points of HMVC

I'm new to HMVC and whilst tutorials are great about dealing with the overall details of keeping modules separate and only letting controllers communicate, they aren't so great at explaining the ...
-2
votes
0answers
34 views

Loop for PHP array [on hold]

I have a php array that has a dynamic amount of values depending on the user. The original array can be customized. I need a loop that will loop through all values so that it can determine weather or ...
0
votes
1answer
101 views

Benefits of an existing framework for a solo web developer [on hold]

I have been writing Core PHP apps for 10 years now, and I feel very confident using PHP to do exactly what I want. I enjoy writing well architected, clearly documented, well structured code that I ...
-2
votes
1answer
55 views

Is there a simple way to “scanf” multiline string? (or “parse-file-by-template”)"

I have a bunch of VERY similar files. Actually it is a "config" for switches. Currently I am generating it from some kind of template, like so: ! username {username} password 'password' ! snmp-server ...
0
votes
1answer
32 views

Does phpDocumentor tags order matter?

When we document our class, method and/or function with phpDocumentor, is there any specific order I should follow according to the standards? I know it doesn't matter for output the document. Since ...
0
votes
0answers
37 views

Scale parts of image to fill bezier path with no wastage

I want to be able to take an image and stretch/contract each pixel row (or 5 rows for performance) to fit within a curved shape. I've been searching for this for the last few days and have turned up ...
0
votes
1answer
72 views

How to split a Service class in two but still use them like one?

I've got a class: AuthenticationService findLoggedInUser() Checks session if User is logged in. If not, check client persistent user login cookie and log in. loginUser($email, $pw, $remember = ...
-3
votes
0answers
35 views

how to work in team and organize tasks in web development [closed]

My problem is that i used to work as a freelancer web developer. Now i work in a company and have a small team. I'm responsible for organizing this team to work in a project. I have no idea about ...
-2
votes
2answers
110 views

php make dollar optional [closed]

Is there any reason the PHP language could not be updated in a future version to make the $ prefix on variable names optional? Reasons that would break existing code? I'm thinking it would still be ...
-1
votes
0answers
43 views

SEO Friendly URL In Website [closed]

I want to develop a website in CodeIgniter framework in which I can access any webpage via slug. For example just like WordPress and Magento we can access category page by ...
1
vote
2answers
203 views

Workflow for obfuscated PHP code with PHP protect

Let's say I have a database-driven web application written in PHP. After obfuscating the code with PHP protect it will be copied to a web hosting server. And here is the question. What is the ...
1
vote
1answer
89 views

How to tell the View to create a cookie?

I have a LoginService class with loginUser($email, $password, $remember = false) method in the application layer of my model layer. Now, if $remember is true it needs to create a persistent user ...
3
votes
4answers
359 views

Why is the use of conjunctions in method names a bad naming convention? [closed]

In my team, we work closely with a few software architects. They approve all design decisions of our projects, do some code reviews etc. Our projects consist mainly of backend functionality ...
0
votes
1answer
140 views

Version controlling of a web project

We (2 developers) are developing a cakephp app that is running on a remote server. In NetBeans we both have project set up as "PHP application from remote server". The problem is that whenever one of ...
2
votes
1answer
110 views

Using the command pattern for a sequence of tasks

I have a 'sequence of tasks' to undertake on a zip file. It can be simplified into these steps: Validate that the file is a ZIP file and is valid Unzip the file Validate the contents are as ...
0
votes
1answer
115 views

Viable method of sharing our PHP project [duplicate]

We are two developers that have no previous experience in sharing one PHP project. In particular, cakePHP. We both use NetBeans and we have set the project up as a "PHP application from a remote ...
1
vote
1answer
131 views

In MVC design, do I use a base class over an interface?

In web MVC most designs I've seen, (just choosing model layer as an example) the domain problem class, say students, always inherits the superclass "Model." The name is irrelevant, but why do they ...
-1
votes
0answers
5 views

In PHP how to save directory the php file is in to a variable (centos) [migrated]

so say my php file "example.php" is in the directory "/user/example" I thought that the line "$dir = getcwd();" would save "/user/example" to $dir but instead it is saving the directory that the user ...
-1
votes
0answers
65 views

Helping with creating own PHP MVC - how to write good router

1 year ago I created wannabe-MVC in PHP (some parts procedural, some in classes), now I'm intending to expand it a further to be more like real MVC. Folder/files structure: html/ html/images/ ...
3
votes
2answers
124 views

Whether to store all numbers or just their ranges in database for this application

I'm developing a (PHP MySQL) Web App which will sell dynamically generated real time cell phone numbers for cellular companies. A company will ask for, say, a thousand numbers and this app will check ...
0
votes
1answer
134 views

How do I keep my classes in MVC from becoming bloated?

I'm not sure how I should have worded the question. If I have a Student and Classes database, and I have queries that involve both. Where do I put my queries? In one case, someone wants student ...
0
votes
1answer
71 views

Efficiency of getters/setters with database performance

I'm currently in the process of refactoring a very old personal project of mine, which used procedural PHP-in-HTML code. I'm modernising it as a learning project, using OOP where beneficial. I ...
0
votes
0answers
44 views

Database conceptual Question [duplicate]

When querying in database through PHP, is it good to open mysql connection before every query and close it as the query completes? or should we open the mysql connection as soon as the first query ...
0
votes
0answers
2 views

import existing pdf using TCPDF library [migrated]

I'm trying to import an existing pdf file to digitaly sign it using TCPDF library $pdf = new TCPDF_IMPORT; $pdf -> importPDF('example.pdf'); when I do so I get somthing like this So, what is ...
0
votes
2answers
132 views

Database Handler and SQL injection prevention

I've written a database model class in PHP and have written a controller class that specifically validates the data before sending it to db. I'm getting criticism that I should handle the data in ...
0
votes
1answer
296 views

Does this function do one thing only?

Is the following method considered to be doing one thing only? I'm wondering about that since it takes an optional argument. public function findErrors($name = null) { if ($name) { ...
1
vote
1answer
84 views

Is routing a site with RESTful not the best when you have very long URLs?

I've read a lot about RESTful, but I have always had a hard time figuring out how I'd use it with a very long query string. This is an in-house project, and it won't always have a simple /someAction ...
0
votes
0answers
24 views

Pitfalls of combining dependant traits and exceptions in same file as interface in php

What are the potential pitfalls of combining related class like objects (interfaces, traits, custom exceptions) in the same source file? For code reuse and only loading what I need I always separate ...
0
votes
0answers
68 views

Best practice: dynamically handle variable data, multiple file uploads and encoding with jQuery, AJAX, PHP and MySQL

I'm currently writing an e-learing web-application. I'm sorry if this is information overkill but I think it's better to describe it in detail so you get the idea. I have made thought on every point ...
1
vote
1answer
157 views

Basic PHP Object Oriented Design Review

I am attempting to learn object oriented programming by designing a simple web application related to the Catholic liturgical calendar. I have very little formalized training in programming, but I ...
4
votes
2answers
132 views

Strategy to use two different measurement systems in software

I have an application that needs to accept and output values in both US Custom Units and Metric system. Right now the conversion and input and output is a mess. You can only enter in US system, but ...
1
vote
1answer
136 views

Dependency injection in constructor, method or just use a static class instead? [closed]

What is the best between: $dispatcher = new Dispatcher($request); $dispatcher->dispatch(); and $dispatcher = new Dispatcher(); $dispatcher->dispatch($request); or even ...
0
votes
0answers
51 views

Approach for packing 2D shapes while minimizing total enclosing area

Not sure on my tags for this question, but in short .... I need to solve a problem of packing industrial parts into crates while minimizing total containing area. These parts are motors, or pumps, ...
6
votes
2answers
183 views

Is this a valid implementation of the repository pattern?

I've been reading up about the repository pattern, with a view to implementing it in my own application. Almost all examples I've found on the internet use some kind of existing framework rather than ...
-1
votes
2answers
89 views

Billing from card directly [closed]

I, for the life of me, cannot find any literature on this, simply because I have no clue how it is called. I want to learn how to implement a payment option that consists of paying with your ...
-5
votes
1answer
116 views

CAPTCHA blocking for my scraping script? [closed]

I am working on a scraping project which involves getting web data and parsing them for further use. I have been working using PHP and CURL to make scraping scripts which crawls web data and I make ...
1
vote
0answers
59 views

Single complex or multiple simple autoload functions

Using the spl_autoload_register(), should I use a single autoload function that contains all the logic to determine where the include files are or should I break each include grouping into it's own ...
0
votes
1answer
156 views

Design Pattern: A single class with multiple purposes, or multiple extended classes each with their own purpose in PHP

I'm working on a PHP framework called Carbon CMS. This framework will be used as base to build larger web applications on top of it. This framework should provide all kinds of interfaces such as ...
0
votes
2answers
112 views

When running PHPUnit tests - is it common to use a separate database for testing?

I'm running tests from the same database as I use in development. I recall using Rails and I used a separate database for testing (mainly coz the tutorial I was going by said so). Made sense though. I ...
1
vote
0answers
89 views

Parent class loses coupling after I refactored identical code blocks from child classes to parent

I have a class called Parent, and classes called Child1, Child2, etc, I have noticed that child classes have a series of function calls that had same (duplicated) lines of code that could be ...
0
votes
0answers
62 views

How to handle bad code base [duplicate]

Company I worked for recently inherited a custom CMS system that is extremely buggy, no documentation, and unreadable logic in everything. The client will not have the budget to re-platform for ...
0
votes
1answer
87 views

Non Existent Keys Returning Null Instead of Exception

I have inherited a project from another developer, and it is riddled through and through with the following type of error: echo $data['example']; Notice: Undefined index: example Obviously, I'm ...
1
vote
0answers
115 views

Menu building pattern

I'm having troubles getting my head around the active-state handling of a menu when the menu isn't used for routing. I come from Drupal where the menu system handles the routing as well. so setting ...
2
votes
0answers
107 views

On implementing a dynamic proxy in PHP

I'm trying to implement dynamic proxies in PHP and I'm running into a problem of implementing interfaces. My current approach to building a dynamic proxy is by having a class which uses the __call ...