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

learn more… | top users | synonyms

-1
votes
0answers
21 views

The @copyright tag and years in PHPDoc

I currently use the standard PHP PEAR for my project, which asks me to include the tag "@copyright" in all my PHP files. I'm looking at the documentation PHPDoc: ...
-2
votes
2answers
70 views

What kind of license to put a private project?

The project in which work is private for commercial purposes and not its source code is distributed to anyone. Only the functional application shown consumers through a website. It has the following ...
-4
votes
0answers
36 views

PHP getting just first parameter from $_GET? [on hold]

my url is http://localhost/test.php?a=1&b=2 In PHP 5.6.13 script I cannot retrieve b param via $_GET['b']. Can someone explain me why ? Any bad php.ini settings ? Thanks a lot.
-3
votes
2answers
59 views

Need help to make advance search in PHP

I am making a railway search website for university project. I want to implement an advanced search functionality, but as I am new to this field, I need help from you guys. Please help me to create ...
-2
votes
0answers
26 views

Adobe Illustrator: Data-driven Graphics via PHP

I'm not sure if this is the correct forum to ask this question. It appears that Adobe Illustrator (and presumably Photoshop, etc.) files can accept external data to render an image. See ...
-3
votes
0answers
29 views

Web design templates for backend developing [on hold]

I have been using PHP for 2 years now and I really like it, I started creating small projects but I started getting bored of creating a new design for my project every time, it is such a long process ...
-6
votes
0answers
36 views

Can you please explain what this php code below does? [on hold]

I just need the logic behind the statement because the idea of escaping strings doesn't seem to make sense to me. What does this code do ? and why is it escaping strings ?What does this code do ? and ...
1
vote
1answer
76 views

Multiple instance of the same class?

I have a class named "Category" to handle all the operations and data about my categories. Now, my class is created however I need to find a way to build an object for each of the categories in my ...
2
votes
2answers
70 views

How do I decide whether to make an Input/Output data type an array or a class?

I have some input that I send to a computational library, which processes the input and produces some output. Question: What considerations do I take into account to help me decide whether the ...
-3
votes
0answers
53 views

is sockets good way to handle high number of request with php [on hold]

I want to implement a web application that gets requests from GPS of vehicles every 5-10 seconds and save them in database, so there are many request to server. Someone said using php sockets with ...
-2
votes
1answer
91 views

What is the difference between these two php operators?

What is the difference between these 2 PHP operators ? The first one is = and the second one is .=.
-1
votes
0answers
24 views

sortTraceRoute function unknown

I can't find this function "sortTraceRoute" anywhere on the document, meaning it's not user defined. The application works - anyone familiar with it or knows what it does? ...
-1
votes
0answers
33 views

How to make a label act as a button [on hold]

I have form in that I have three input type file buttons, Those are used to upload images and in front of each and every button i need to put a remove image button but the problem is when click on the ...
1
vote
3answers
147 views

Using multiple languages

I currently have a website running PHP laravel. We came to a point where we want to add a user-backend -- where users sign-up and can access functions when logging in. My question is; Is it possible ...
3
votes
2answers
189 views

Extending the flyweight pattern: an oxymoron?

I'm developing a BNF parser in PHP, for my own flavor of BNF. To keep the resulting parse tree, consisting of objects, as lightweight as possible, I decided to use the flyweight pattern for literals ...
4
votes
1answer
186 views

Do I have to stop using Dependency Injection to keep object debug printouts small?

Say I have a large object - think EntityManager of an ORM such as Doctrine, or a custom DAO object, or what have you. Object, output of which is required to be used inside a class, but the object ...
1
vote
1answer
77 views

Safety of magic setters in PHP

I don't know how in else languages, but in PHP seems to me that they are very unsafe way how to set value of any member variable - because one setter cannot easily validate input for many variables ...
2
votes
1answer
72 views

PHP OOP, structuring my objects properly

I have an architecture similar to this: User (Name, Email, ID...) ---- Studios (Name, Location, Description...) ---------- Videos (Title, Description, URL, Length, Views...) Simply put, a user can ...
-2
votes
0answers
48 views

Testing A Website That Reads Excel Sheets Into A Database [closed]

I made a webpage that reads excel sheets into a database. What would be the best way to test this sort of software? The best I've come up with is to manually query the database after uploading ...
0
votes
0answers
38 views

need help in setting up a client side workflow for SMS OTP confirmation

I have a website in which I am setting up an OTP verification process for mobile numbers, in which I have successfully completed the server side process in which I can request OTP code on my mobile as ...
1
vote
0answers
29 views

auto generated web CMS for pre-existing SQL db?

What I'm looking for is a way to auto-generate a simple web-based CMS for a simple pre-existing SQL database. To be used by 'app administrators', not the general public. Something that: allows ...
1
vote
1answer
82 views

How far do I separate Model code from Controller code when writing MVC?

I have some code where Controller depends on the Model, and in my case Model acts like a Database Access Object. use FQDN\Model; class Controller { /** @var FQDN\Model */ private $model; ...
1
vote
0answers
33 views

How to architect rule matching with multiple conditionals and outcomes

I'm working on allowing my users to create their own ruleset for data that's coming in. All of the data below is sample mock data and not in relation to our product. Example of a rule (there can be ...
5
votes
1answer
76 views

Am I using Zend Form library correctly? (I am effectively duplicating work in Controller and in View)

Brief Summary This question is asking for guidance on how to deal with Zend Form library that allows me to specify how to construct each form element (Controller side) and how to render each element ...
-3
votes
0answers
43 views

View being rendered twice [migrated]

I'm making a small mvc based website and ive run into a small issue. I have a form that as a dropdown which should be populated with values from the database. My model code is: <?php ...
2
votes
0answers
43 views

Fine-grained data level permissions on a laravel RESTful API

The problem: We want to restrict access to properties returned from our services. Details: We have route level permissions working with no issue. For a user that can view /product/{id} for ...
1
vote
0answers
29 views

How to persist a session cookie in a PSR7 request/response middleware?

I am building a package that implements native-like sessions in a PSR7 middleware architecture. I created a middleware which is responsible to create and persist a session cookie. The session is also ...
1
vote
2answers
64 views

How to sync the data from the same user across multiple devices

I'm working on a small fitness app in which the user (whom is authenticated with the a server) could create their own workout plan which will be synced with a server. The problem with this is that ...
-3
votes
0answers
121 views

Using PHP to connect to a remote database to execute an SQL query [on hold]

I am new to PHP (with a little experience in HTML, CSS, and SQL). I am attempting to create a simple form that queries an SQL database and then returns a result. The database is stored on a different ...
3
votes
3answers
234 views

Modern recommendations for password recovery

I'm going to implements password recovery in my authentication. I haven't put this together in a while and wondering if there is anything I ought to be aware of. My idea at the moment is: User ...
0
votes
0answers
47 views

Data Mapper pattern vs. model encapsulation

I am currently developing my first custom data mapper layer but have run into a conceptual problem that seems to be glossed over all books and guides I have read. My problem is as follows. My data ...
0
votes
1answer
114 views

Is there ever a reason to use variable variables in PHP rather than an array? [closed]

Is there any situation where an array is not suitable but a variable variable is? I cannot think of one or find one on any Stack Programmer Q&A. <?php $foo = array(); for($i = 0;$i < 3; ...
1
vote
1answer
75 views

Make PHP sessions truly last until the browser closes, and regenerating session on page requests

We have an issue where sessions are ending after a short time, 1440 seconds according to gc_maxlifetime settings which seems consistent with the issue. The PHPSESSID says it will expire when the ...
1
vote
0answers
43 views

How to handle optional dependencies in php?

At my Job I'm currently on refactoring a very old php CMS. By now, "code handling" was done by simply copying the whole thing and modify it to fit whatever was needed for this job to be done (actually ...
0
votes
0answers
60 views

Proper way/place to apply decorator pattern for view layer in mvc

I have an array of model objects containing data some of which is states represented by integers. In the view these states are shown as icons and tooltips. The tooltip is needed only in the view and ...
0
votes
0answers
27 views

“remember me” functionality but user database on another app on another sub-domain

I'm considering how to add remember me functionality to our app. However we have our app, and a separate app that handles authentication on another sub-domain. When authenticating from one of our ...
2
votes
1answer
55 views

Set authenticated users session cookie's to long term, but others to short term?

We want to extend the session duration for our users. I guess it doesn't matter for users who are not authenticated. We can create a PHPSESSID cookie for them and if it expires when they close their ...
0
votes
1answer
103 views

Is it worth it to follow code conventions of Netbeans? [closed]

I am always not able to follow Netbeans default coding conventions like the following Function should be N lines only Method Length is N Lines (M allowed) Warning: Do not Access Superglobal ...
0
votes
1answer
82 views

Saving an image in MYSQL vs saving to a folder [duplicate]

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.
0
votes
0answers
25 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 ...
1
vote
1answer
64 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
35 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 ...
2
votes
0answers
77 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 ...
2
votes
1answer
77 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 ...
3
votes
3answers
180 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
64 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
121 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
vote
1answer
81 views

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

I would like to have a class creating any code from given options and output it in a chosen way. I have written class for generation of simple JavaScript code for such cases where is needed to ...
0
votes
2answers
91 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
83 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 ...