The fifth version of the PHP: Hypertext Preprocessor (PHP) scripting language. It features the Zend Engine 2, better object model support, and many other improvements over PHP 4.
2
votes
1answer
30 views
Reading XML files from RSS of different websites in PHP
I've created a working XML RSS reader. I wanted to know if it's a good one or not and if it's efficient for the server or not. I run this code every 12 hours or something give or take the amount of ...
2
votes
0answers
19 views
Nginx rewrite optimization for PHP execution
I've posted an excerpt from my Nginx configuration with the hope that someone can give me advice on anything I've done wrong or could do better. Please note that the below config works, but has been ...
2
votes
0answers
21 views
OOP Web scraper using regex to grab tag contents
I'm about learning about implementing the solid principle in PHP.
I want to create simple content crawler/grabber from some websites. This crawler will grab the content from the website url. Since we ...
4
votes
1answer
77 views
Database connection wrapper class
I am trying to create a PHP / MySQLi wrapper class that uses prepared statements, the goal of the class is to create a connection to the Database, then INSERT / ...
2
votes
2answers
99 views
Selecting results as a comma-separated string
The below code is working correctly, however, I am not sure if the combination of while, foreach and ...
1
vote
1answer
40 views
Including a header file with proper content and structure
I am new to HTML and programming in general and am currently working on setting up my first website.
For this I created a couple of PHP pages with a separate file for each of them and in order to ...
5
votes
1answer
135 views
Website user password verification
I have a login web page where a user enters their email and password and I need to check if:
the entered email exists in the DB and
the entered password matches the hashed one from the db.
The ...
4
votes
0answers
87 views
Write a HTML table from MySQL tables
I have a piece of code that generates some tables:
bp_rows: where I take a snapshot of some "headers" for each row of the table.
...
0
votes
0answers
59 views
PHP connector for communicating with a REST API (part 2)
I wrote a PHP connector that will allow me to communicate with a REST API using PHP.
The class was little over 1500 lines of code, it was difficult to manage it. It was a nightmare to even look at it ...
2
votes
1answer
84 views
PHP connector for communicating with a REST API (Part 1)
I wrote a PHP connector that will allow me to communicate with a REST API. This is the first time I am trying to make my code as clean as possible. I want to help myself learning how to better code.
...
4
votes
3answers
61 views
Database select script
Is there any way I could improve this script, such as by writing it in fewer lines (more efficient)? I'm very interested in keeping my code dry and fast! Also, if there is a way to make it more ...
6
votes
1answer
264 views
Routing for a Laravel 5 e-commerce site
I am new here and learning Laravel 5 on my own. I want to get reviewed on the following routes.php code.
My question are:
Have I made any mistakes by doing this? If yes, then what could be the ...
4
votes
1answer
231 views
Router for personal use
This is router I created for use, however, I wish to refactor this code and make this more robust. I would really appreciate anyone who can:
Point out how to make this code more robust, clean and ...
2
votes
0answers
53 views
Configuration class
This is my first serious programming effort, so I'd like some comments about what I did so far.
Project structure:
...
3
votes
2answers
61 views
Allowing googlebot to crawl a password protected page
The below I have put together as an experiment, I have profiles on my site that are password protected. I would still like them to be crawled by google.
The script is taken from here and basically ...
0
votes
2answers
154 views
Shuffle Symfony entities
I've got an object $contest which is a Symfony entity that has some other entities assigned. I can get them by ...
1
vote
0answers
111 views
FilesSynchronizer: Synchronize local and remote filesystems
I have written a library that syncs files between two filesystems. It works fine, but I'd like some other developers to have a look over the existing code. Maybe I can optimize something.
It is using ...
2
votes
2answers
83 views
Validation class
Can someone help me furnish my PHP validation class? I want to reduce its size and make it easier to use.
...
0
votes
2answers
339 views
Am I correctly implementing PHP/PDO and the MVC/DAO pattern?
Context:
I am working on the login module of a PHP web-application and I am trying to implement this using PHP/PDO and the DAO pattern. I would like someone to review the code below and let me know ...
2
votes
0answers
37 views
View helper for creating HTML elements with DOM
I have attempted to create a view helper class which makes programmatically creating HTML strings less verbose and hopefully simpler.
This is inspired by the tag helpers in Rails. It's compatible ...
3
votes
0answers
221 views
Laravel controller for a commenting system
Can someone review my Controller? I should follow these guidelines:
Code should be written with MVC pattern and to use OOP.
The code now works fine, but I need to improve it. Also, should I use ...
5
votes
1answer
82 views
Static registry
I am working on a base framework for my various PHP related projects. I have grown since beginning all of this, but the one area I am still having difficulty/concerns with involves the dependencies of ...
4
votes
1answer
46 views
2
votes
0answers
33 views
Complete date ranges for two years
I have array contents with some date ranges, fetched from the database:
...
2
votes
1answer
127 views
Formatting a date range, with shortening if the interval falls entirely within a calendar month
The graphic guy wants to display dates like
16. February
17. - 24. February, or
...
1
vote
1answer
39 views
Checking if the site resolve a DNS or not
I've written code to check whether a domain resolves DNS or not like follows. It is working fine, but I doubt whether there is a simple way to check this by using `dns_get_record'
...
3
votes
1answer
90 views
PHP MIMEType class
There isn't a very reliable way (in my opinion) to get the mime type of a specific extension, regardless of the file actually being of that type or not.
This type of thing usually is used when ...
1
vote
0answers
104 views
What can I do to this PHP CRUD Object to make it better?
I'm trying to create a single class to interact with my database (MariaDB, in this case). Is there anything I can do to improve this code? I'm fairly new to PHP OO.
...
1
vote
1answer
98 views
PHP DOM XML Creation
I am currently working on Shopify webhooks which posts XML to the Colorado timber line API. But due to the order protocol of the Colorado timber line API, it is required to modify the XML posted by ...
0
votes
2answers
245 views
Form submit using POST handled in PHP
I have this code working for submitting a form using PHP and HTML (Bootstrap). I did not post the CSS, so I hope this is not an issue.
I am interested if this code is clean, following good practices, ...
1
vote
1answer
591 views
Product page filter
I am still learning Laravel and I am in the process of creating a small shopping website.
On the left hand side there are a series of filters that appear depending on what products have come back ...
1
vote
0answers
1k views
Parsing multipart/form-data in php for PUT requests
I have recently found that I needed to be able to parse multipart/form-data for PUT requests made to my REST API. This allows batch photo uploads, which has been a requested feature. As we all know, ...
0
votes
1answer
99 views
Image manipulation PHP class using PHP's Image Functions
I am working on an image manipulation class for a project to re-size uploaded slider images to 780 X 397 and uploaded avatar pictures to 220 X 220. I am wondering if this is a good way to construct ...
3
votes
1answer
89 views
Calling a MySQL procedure with an arbitrary parameter on a GoDaddy website
I'm deploying a PHP project, and I always try to use prepared statements, but unfortunately, GoDaddy does not have the mod mysqlnd which I use it for the function ...
3
votes
0answers
272 views
Laravel Testing: Is this testing too much of the inner workings?
So I'm using laravel for a project and have a InvoiceRepository and a InvoiceRepositoryTest and I have written the test first ...
2
votes
1answer
676 views
Sorting an array to match the order of values of another array
I'm running hundreds of curl operations in parallel to my own API, the response array that I get is out of order (the reason being that the first one to finish gets added to the response array first). ...
8
votes
4answers
232 views
Blog/Forum implementation
I've started learning PHP for university-related projects today. I tried implementing a basic blog/forum. Here's the full source code.
It has the following features/design-decisions:
There are ...
2
votes
1answer
48 views
Optimizing mcrypt encryption class further
The following is a very simple implementation of an Encryption class using mcrypt whereby the functions encrypt and ...
3
votes
1answer
53 views
Geocoding library
I've written a Geocoding library that is hosted on Github. It has got 7.9 rating by the scrutinizer. I've checked and the only thing that I think I can improve is ...
2
votes
1answer
151 views
Extracting components of a street address
I have got the following function in my class that I think can be further be improved but I'm lacking ideas how:
...
4
votes
0answers
112 views
Zf2 and doctrine model implementation
I've implemented for the first time Doctrine-ORM on my SOAP server application; can you tell me if I could optimize some of the written ORM-related code?
More specifically, is it a good practice to ...
5
votes
1answer
470 views
Doing a roll back with multiple MySQLI prepared statement
This is my code for doing a roll back with multiple MySQLI prepared statement.
I want to know if anything is wrong with the code.
...
2
votes
3answers
624 views
Finding combinations of 3 numbers
What this code tries to do is find possible combinations of three numbers. For example, let's say I have the following numbers:
1, 2, 3, 4, 5, 6, 7
Some ...
2
votes
2answers
80 views
Simple class, solely for setting “globals”
I'm aiming for the best and simplest way to access "global" variables set in the config file for my website. So I can use them anywhere, even inside functions
It's for file versioning, and I use ...
3
votes
3answers
177 views
Complex if statements in authentication method
I had asked questions about my entire class which I'll flag for closing soon. It appeared to be a little too broad for 1 post so I chopped it up and will be asking a little more specific questions ...
3
votes
2answers
120 views
Pagination filtering
I want to check if there is page variable (in URL) and if it is, if it's correct - it cannot be number 1 because this is default page and it should be valid int ...
0
votes
2answers
253 views
Validating basic data objects
I'm playing around with trying to do things in a better way, and in a class I have for sending emails, I have the concept of a recipient. This gets passed into my other classes essentially as a struct ...
4
votes
1answer
849 views
Extendable PDO Wrapper Class
I've created a PDO wrapper. I understand PDO could be used on it's own, and I'm reinventing the wheel as there are solutions like Laravel's Eloquent that would do a better job.
I'd like advice on ...
1
vote
3answers
133 views
Dependency injection/dependency injection containers in MVC web app
I just learned about dependency injection/dependency injection containers, and I realize that the controller in my MVC web application is hard to test.
My original controller class:
...
13
votes
1answer
245 views
Cryptographically-secure super-secret government message transaction machine
-Hello Agent. Are you on a secure line?
-Yes, secured.
-Good, in 30 seconds the launch codes will be in your e-mail's inbox.
You now have the go. Are you ready for the package?
...