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
14 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
35 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
66 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
32 views

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

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

php make dollar optional [on hold]

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

SEO Friendly URL In Website [on hold]

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
195 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 ...
-3
votes
0answers
42 views

ISBN Code - What is the purpose of Publisher Code in an ISBN? [closed]

I want to understand the logic of how the Publisher Code range provided by ISBN Authority gets mapped to an ISBN. From the below links, http://xml.coverpages.org/costello-isbn-xsd.txt ...
1
vote
1answer
87 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
351 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 ...
-4
votes
0answers
42 views

How to make script with faster queries? [closed]

I have project to share useful urls with some information about the url. the project using: add new post ( opening bootstrap with textarea ) user add content (url , hashtags, text) the js fetch ...
0
votes
1answer
136 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
107 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
128 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
133 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
70 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
125 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
292 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
23 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
61 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
156 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
131 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
134 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
178 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 ...
-4
votes
0answers
14 views

how to install lib_mysqludf_sys.dll? [migrated]

I have put the "lib_mysqludf_sys.dll" in C:/Xampp/mysql/lib/plugin. in "my.ini" config file the plugin directory has been set correctly. after putting that .dll file in the appropriate place, I ...
-5
votes
1answer
105 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
154 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
111 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
87 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
86 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
106 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 ...
0
votes
2answers
77 views

Encapsulation: Separate functions for separate variables, or return a table? [PHP]

I have been making a website with PHP and I have a few classes, so far none of them really follow encapsulation rules of OOP. Lets say I have a user class like so: class User{ public $username; ...
0
votes
2answers
58 views

Storing and accessing settings from database query

I am trying to figure out the best way to accomplish this so feel free to criticize my thought process. My tool has different locales and each locale can have different settings for the tool. For ...
5
votes
2answers
206 views

How to handle a vendor who asks for the solution of an issue they could not solve

Being a small department of developers, it's not uncommon for us to outsource projects. We have a set of companies that we really like to work with, very reliable and good local people who appreciate ...
1
vote
1answer
157 views

API Key DDOS protection

Hi I just wanted some feedback on a DDOS preventing php script that I'm designing. It is quite simple and I wanted some feedback on whether you guys think it would be effective. I'm currently using ...
2
votes
2answers
204 views

Best pratice for return json in a REST application?

I'm starting now with REST (using Laravel 4.2) and Mobile (Android, iOS, SP, etc.) applications. Initially I'm checking if the request is ajax/json and then return a json response. But this ...
0
votes
0answers
110 views

When to use packages or Repositories in Laravel?

I'm a Laravel (PHP) developer, and new with DI, Packages (workbench) and Repositories (Pattern). I want to know about the best concept/methodology for a more flexible design; ie. the project can grow ...
0
votes
1answer
34 views

Roles configuration strategy

We're close to start new project using sf2, and, probably, FosUserBundle. Keeping that in mind - what's the best strategy to define roles? App will be used by multiple divisions inside our company ...