Tagged Questions
4
votes
1answer
91 views
My simple PDO wrapper class
I made a simple database class and I wanted to know if there are any improvements I could work on as far as readability, efficiency, methods and making it modular goes.
Any other suggestions are also ...
3
votes
1answer
44 views
3
votes
2answers
183 views
0
votes
1answer
99 views
3
votes
1answer
59 views
advantage of using __call method
I have wrote simple class that allowing database selection and inserts.Could you please tell me does this a right way to use __call method with any useful advantage of it ?
...
3
votes
2answers
968 views
1
vote
1answer
63 views
Optimized Form fields generating class
I am building an application full of forms and so I thought it is good idea to create a class to populate form fields.
Here is my class and I am sure it can be optimized more than now and could be ...
1
vote
2answers
129 views
Creating a Party Game to learn OOP
I've been developing sites using Dreamweaver for the last 15 years, I do a lot of code editing manually so I have quite a good knowledge of the PHP language.
I'm diving into object orientated ...
3
votes
1answer
132 views
Flat-file DB with CRUD
I just finished writing a flat-file DB class for PHP which supports selecting, updating, inserting and deleting.
I was wondering if there are any ways to make it faster or if I'm doing anything the ...
6
votes
2answers
387 views
Any way to improve the performance of this PHP class?
I have been developing this class, and was wondering if anyone had any thoughts on how I can improve the performance of it.
...
3
votes
1answer
492 views
Cookie Management Class
I wrote this class to make cookie management easier.
I know it makes use of serialize(), but I have no intention of storing very much data in the cookie, and it ...
3
votes
1answer
91 views
Is this a complete PDO prepared class?
Is this class perfect for databases? All I want to know is what I should change to make it perfect.
...
2
votes
1answer
89 views
“Property Container” design-pattern
I've tried to write my Property Container design-pattern implementation.
Could anybody, please, tell me, if this code is really what I intended to write (follows ...
0
votes
0answers
33 views
Classes to iterate over millions of records, performing calculations and comparisons on each
I'm converting a PHP written with a lot of procedural loops to classes. There is a hierarchy of nested information represented in nested associative arrays. The actual records are from currency ...
1
vote
1answer
51 views
Is this a model? What is controlling it (controller?) and how does the data get to the view?
My goal is to instantiate a class based on the request and call a method on it based on the request verb. The classes I'm referring to will have methods such as ...
2
votes
1answer
79 views
Best structure for a Person in PHP classes (and databse)
I am (in the process of) creating a system to store People and their details - names, date of birth (dob), addresses, phone numbers, etc. - and I'm curious how it is best achieved. Below is an an ...
3
votes
1answer
83 views
Best practice to create XML messages with DOMDocument class in PHP
I want to create XML messages for webservice communication. These messages should be created from a pool of reusable elements. Therefore I have created different classes. A "factory" class, that only ...
4
votes
1answer
310 views
Using POST data to call a function from a specified class
I've inherited a class in a project which is purposed to execute a function that exists in POST data from a specified class. I've tried to clean this up as much as possible as well as secure it ...
4
votes
2answers
164 views
Handling access to database connection both inside and outside of classes
Is this an OK way to handle access to database connection both inside and outside of classes?
I used to include a PHP file -- database.detl.php -- at the very top of my index.php file containing the ...
5
votes
2answers
76 views
Specific PHP Data Access Class review
As part of a fun project to help build my knowledge of PHP. I've written a Data Access Class here to bridge the site to the database. I know there are a lot of ...
0
votes
1answer
62 views
How to put a lot of information in the class?
I have such a problem:
I'm parsing a lot of HTML files with Simple HTML DOM Parser, that's why I need to use three foreachs to parse the necessary information from ...
0
votes
1answer
192 views
Review of my PHP Wrapper around Third Party Soap API
I have written a wrapper for Soap based 3rd party web service.
https://gist.github.com/veganista/bd940750d9e240e63b89
I'm pretty happy with it so far (I think, anyway). It's only a small sub-set of ...
3
votes
2answers
319 views
Classes and variables in PHP
First of all, I'm trying to learn OOP PHP, so any advise will be great.
My idea is to create some kind of MVC Framework CMS kind of thing, just to learn OOP PHP and MVC well.
Let's say that I've got ...
3
votes
1answer
1k views
PHP Config Class
I'm working on a config class for PHP, where I can easily bring in config options. Any improvements/suggestions are appreciated.
Example usage:
...
0
votes
2answers
289 views
PHP PDO Custom class ple
i created a database class from a good tutorial and wanted to put it up here so it would get in some search results. it took me about 2 days to find it. also i added a few custom functions to it.. ...
0
votes
2answers
409 views
Critique Requested on PHP Pagination Class
I did most of my PHP coding back with PHP 4, and among the projects I did was a popular pagination class. I've been meaning to bring it up to date with PHP 5 and OOP practices. I've also been working ...
2
votes
1answer
145 views
3
votes
1answer
100 views
Review/rate my new graph class
I have written a PHP class called "graph". It is a class that performs RESTful-like commands to a MySQL database. I have posted the GitHub repo.
Here is the code as well:
config.php
...
1
vote
2answers
489 views
Staticton (Single static classes) in PHP [closed]
I know singletons are held in poor regard, but as I am writing my web app I feel like some completely static classes would be helpful.
Of course, not much should be static, but what about things ...
1
vote
0answers
182 views
Basic structure of a simple php REST api
I've read plenty about php OOP design principles and patterns. I can work with classes and inheritance. My issue is with actually using classes for some purpose. In this case, I want to create a ...
7
votes
1answer
513 views
Critique Request: PHP Request-Method Class
I'm working on a general Requestmethod class which sanitizes and recasts the input of users in an automatic fashion. I've also tried to do array-access in cookies.
...
1
vote
1answer
295 views
File Downloading, Unzipping and extracting Content - PHP script and tests
EDIT. Here is the new version after bumperbox's very helpful suggestions.
I was thinking or renaming into Downloader or something but the problem is, I see downloading is performed at lower level of ...
1
vote
1answer
200 views
Representing database row as a class
For my current project, I have elected to represent database rows as objects.
So an individual comment can be retrieved as a class like so:
...
0
votes
1answer
607 views
Good, flexible and secure MVC router PHP
I have developed a new router after having learnt a lot from my previous attempts and I will be using this in sites I make from now on.
In a previous question, the issue of REQUEST_URI being too ...
2
votes
0answers
45 views
Another php upload class
i know there are many php upload classes out there but i'm mostly comfortable with my own code.
So i made a simple one here.
I'm interested about your opinion on the approach on image files in case ...
3
votes
1answer
74 views
How do I refactor this basic form handler
I've dabbled with PHP for a couple of years, I can generally get what I need done and I've been teaching myself PDO. The problem is I want to set it up with classes but i'm not really sure how to.
...
1
vote
1answer
58 views
autoloader class fine tune to be usable in every project
I'm open to any advice to help improve this code for general use.
...
2
votes
2answers
183 views
PDO database class review
I've taken this class and made it my own but I'm curious to know what other think of it? Are there things I'm missing? Anything you can recommend?
...
4
votes
1answer
2k views
PHP Extending PDO Class
I am trying to convert myself from using mysql extension to using PDO, with that being said I was curious if I am going about this the right way.
I have a custom logging system that I built I am ...
4
votes
3answers
343 views
OOP Classes, how to put class in class
I've started to learn an OOP and I've built a class called accountactions, and I would like to know if I did a good job writing it.
The class is in the file: accountactions.class.php.
...
0
votes
2answers
649 views
Consistent implementation of PHP class constants (arrays not allowed)
I'm currently writing a class:
...
0
votes
1answer
57 views
Is declaring a property as `public` insecure?
I posted a question few weeks back, on making a PHP Login Script. Most of you guys told me not to use global variables and especially for something like MySQLi ...
2
votes
1answer
235 views
Please review my classes - Database, User and Validator
I am very new to OOP and I am sure this code is very, very bad. I will appreciate if you review my classes and give me some advice to improve them. Any recommendations are welcome. I have also put ...
2
votes
1answer
164 views
Set of classes for generating social plugins, is my design correct?
I've created a set of classes thatwork together to create the html needed to display social plugins like Facebook like, google plus and twitter.
At firsti defined an abstract class ...
4
votes
1answer
1k views
How to improve Try…Catch Block for PDO?
I have written a PDO wrapper and a class file like a model. So far, it's looking so good! I am just confuse where I should put Try...Catch block - Would it be ...
4
votes
2answers
749 views
Validation Class - Feedback Welcome!
I have written a Validation and Form class in PHP.
Validation class allow you to define the ...
3
votes
1answer
353 views
Help improve my first PHP class
I recently started to learn more about OOP in PHP and I created a website for testing. I have 4 classes: database, user, ...
5
votes
2answers
143 views
Improve/Correct PHP Class
I'm looking for code correctness and improvements for the following code. It's my first step into class based programing.
What the class does, is simply to read a directory (path is passed as ...
1
vote
1answer
425 views
PHP Lazy loading with __get - yay or nay?
I have my own PHP MVC framework that I'm iteratively developing (i.e. adding a feature when I have the time). I'm trying to keep it to the best practices I can, while still adding the most in terms of ...
2
votes
3answers
230 views
Am I utilizing classes and OOP efficiently?
In my last question on Stack Overflow I was a very confused newcomer about classes and OOP and how to correctly implement everything to make things easier. So I started a different example to ...