Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
What is the best way to document changes in a function with PHPDoc? Something like
#change 2010.20.16 user added feature x
#change 2010.20.26 user added feature y
would be great. But assume there's no #change option... If i add it anyways, what will PHPDoc do with it? Or is there a better / more correct way to document function changes?
It might be better to just dump your SCM log into a changelog txt file then try to embed it into the source code.
Reasons why:
Staleness - It won't do anyone any good if you stop adding change notes which is likely to happen if having to go on a coding marathon/sprint of doom.
Unconventional - I can't remember seeing a project with that in depth of inline documentation. Sometimes conventions are flat out stupid, but I think the wisdom for this one is cutting down on maintenance.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am looking for the best way to store the application editable settings (ex: Site Name, Is the site closed? .. etc).
It seems like Database is not the best way because I don't want to use a database just for 2 or 3 settings!
So I went to PHP Array but how can I edit it?!
I have reviewed all questions related to this, but I can not find a useful answer for me.
Note: I don't want to edit the settings manually. I want to edit it by php.
You can store the settings in a config file in form of serialized array or JSON.
Say, reading settings:
$settings = json_decode( file_get_contents('settings.cfg') );
Saving settings back:
file_put_contents('settings.cfg', json_encode($settings) );
Of course the file should be writeable permission wise.
You can store anything you want in this array, even simple objects and complex arrays. And as it is JSON you can edit the file manually, too. If a need arises.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm currently working on a project that uses MySQL for configuration, but now I'm starting to think it could slow down page loads.
So my question is, would it be better to store configuration options (that are read almost every page load) inside an XML/JSON file, or a MySQL database?
Thanks.
One thing to conside is how much config data there is, and perhaps how often it is likely to change. If the amount of data is small, then saving this in a database (if your not already using a db for anything else), would be overkill, equally maintaining a db for something that gets changed once every 6 months would probably be a waste of resources.
I think this depends on your projects. If you want someone else to configure the application through the UI you can put the configurations into the database.
If its just you and some developers, and changes are not made frequently, put them in a file.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
To make things short: I'm writing an anonymous forum software with PHP. I just feel like using a database is overkill and restrains my amateur skills. Do you advise against using text files instead of database?
Thanks.
A database has advantages like some sanitation (no breaking of delimiters, newlines etc.) and less danger of access conflicts when multiple instances try to read from the table - and different from a file-based approach, writing conflicts are constrained to the record in question only.
Recommendation: use database
To make things short: Yes. Strong advise against text files.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
All,
I'm curious what the best approach to this would be. In case the tags weren't noticed, I'm using PHP and Laravel 4.
My application requires that users register with an email address that is from specific domain names. Currently there is only one domain, however, I can see it being a requirement to white list others.
I would assume it would be best to put the domains into an array. Would I run a regex from $rules array against that array? I'm somewhat green to regex. I don't use it often enough to commit anything advanced to memory so feel free to talk to me like a 2 year old.
You can create a custom validator for this. See http://laravel.com/docs/validation#custom-validation-rules for reference.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm working on my first opensource project, and I found useful do do an html generator class, treating the html elements as php objects, but now I don't know if it really makes sense in the real world.
Have you ever needed an html generator class for you projects?
If your answer is yes, what would you find useful on it?
If someone wants to help in the project, you are welcome to the repository on github.Github repo
Thank you.
This approach, although liked by many at first sight, always fails a reality check.
Please learn about templates - the only way to go in dealing with HTML from PHP applications.
You need them only if you are some outsourced worker from India or China. Otherwise do not use them since you have potential to ruin your career and credibility.
Those tools are built for doing very dirty code without any future prospects.