What to include in software metric calculation on laravel project? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Laravel project contain a lot of files and folder.
When we are calculating the Software Metric, should we include them all?
I am using phpmetric but it ignored the vendor folder.
But when I use phpdepend , it included that folder.
Thanks.

It depends on what you're measuring, which is why there's no one answer and similar tools may, or may not, include the vendor folder.
If you're interested in the analyzing your own project, then you'll want to point these tools at files you'll be editing. In Laravel 5 that mostly means the app folder -- but you might want to include config and bootstrap, as user created code often finds its ways in those folders.
A reason you might point it at vendor is if you were concerned about the direction a particular code library you use is going, and wanted to measure it over time.
Hope that helps!

vendors (external code) is not important for you. When you measure your project, you should measure YOUR code only:
vendors are already tested / measured in their own repository
if you include external librairies, you don't measure your work
your should exclude generated files (cache...). They are not representative of your work
you should exclude test files : they do not obey the same quality rules
If you want to get information about a particular code library you use, you can check the Github repository of this library. There is a list of PhpMetrics representations of main PHP projects, you can also keep on eye on it.

Related

Managing php config with ansible - lineinfile php.ini vs copy to php.d? [closed]

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 1 year ago.
Improve this question
I'm learning ansible and looking to automate php configuration.
When I look at examples, nearly all are using lineinfile to change /etc/php.ini
This approach works, but seems a bit brittle to me.
Wouldn't it be better to add a custom /etc/phpd./90-site.ini file with all the options you want to customize in one whole shot using copy or template? This depends on PHP being compiled with the --with-config-file-scan-dir=/etc/php.d option but that seems to be the case mostly nowadays. And the actual ansible code will be dead easy, with all the configuration in a template file.
What am I missing?
What are the pros and cons of overriding a configuration file using a multiple lineinfile tasks versus a single copy task?
Without getting into an opinion based answer, let me point you to a hint on the lineinfile module's documentation:
This is primarily useful when you want to change a single line in a file only.
Considering this, if you have multiple lines of configuration to change, using template module to manage a file like - /etc/php.d/90-site.ini makes sense.

What is the basic layout of a webserver? [closed]

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 2 years ago.
Improve this question
Hi Im wondering how to make a basic directory layout for a client if you have php and mysql embeded. I mean the folder layout, and how to name them. So that everyone that develops in the web can recognize it. Is there any special way to do this?
Basic can mean a lot here. The most basic web hosts I worked with just have one folder in it. www (or htdocs, httpdocs, public_html, html) The domain is configured to point into this folder. All files are accessible from the web. Older webservers often had separate folders for perl, cgi, python, etc. stuff. More advanced server offer more folders, for example for logs, automated backups. It can be a good practice for some frameworks to have a separate folder for the source files and create a symlink in the public folder. It really depends on what you want to offer to your client. I would suggest to first of all make a plan on what you want to offer and then try to build a folder structure that mirrors a modular server build. For naming conventions, there are no real standards.

centralize PHP code and MySQL data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I currently have a dedicated server and I'm looking to set up a MySQL database, PHP query code and images directory that can be used by multiple sites. A majority of the sites will be hosted on the same machine, but some will not. My simple way of thinking is that this is possible similar to how Roundcube's code and database is centralized.
Looking for some expert input and direction on whether or not it is this simple or if there is a better way of accomplishing this.
In my opinion, you could two a couple of things to improve your situation:
store your images in just one place, and use that place as a CDN to deliver contents across your sites;
About your code:
if it's possible, use packages in order to create a single package for all the "common" code;
use this package on every site that needs that code, as a simple dependency. Tools like Composer are great to handle dependency management;
No big problems with MySQL databases unless you have big traffic numbers. In that case, you should study MySQL scaling. But first of all, focus on PHP and common assets (like images).
EDIT:
be sure to set appropriate permissions for the external sites, of course;
using packages for your dependencies will be very useful also for sites placed outside the dedicated server;

Is it a good idea to combine all the css within an application into one css file? [closed]

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 have different css files for different modules in my Symfony based application. My client asked me to combine them into one single css file. Is that really a good idea? What way it may impact on my application?
Yes, it is a good idea, because that way, visitor will have to download only one file, which is more efficient.
For from a developer point of view, different files can be more convenient, though.
So often, people will develop multiple separate CSS files, and they have a script that combines these files into one file for deployment.
Two additional steps you can do are
minimize the CSS files by removing whitespace and comments. This will make the download even smaller and even more efficient. Again, you would do this through a script, not by hand. You don't develop in minimizes CSS files, and you certainly don't want to waste time removing comments by hand.
use SCSS or another 'smart' CSS language, so your development CSS files can be smarter and more structured. The SCSS (or SASS or LESS) files are compiled into one final CSS file. Often this compilation will be combined with minification too. Compilation is necessary, because browsers only know 'plain' CSS, not SCSS.
Tip: there are scripts (PHP scripts, mostly) that can do these steps on the fly. Don't use them, because they will have overhead to. Make the minification part of your deployment process. Develop locally, compile and minify on deploy, and let the live environment use the static, minified CSS file.

PHP Project : How to handle general configuration data? [closed]

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 currently starting the conception of a new project that will use either Zend Framework 2 or Symfony 2.
I am currently wondering, as I'm quite a newbie in data modeling and application conception, how to handle general configuration data that wouldn't be linked to my entities. For example, I have constants, numbers, and maybe even texts and medias that should be configurable via an administration and that concerns the whole application, but that is not related to my Model data (for example, the maximum price of products, some general ranges, etc.. that I don't know at all how to store).
So, should I :
Create a "parameter" table or something related, that would store all my global parameters of my application?
Use INI files or YML files (like in Symfony, if I finally use this one) to store my parameters? If so, how to handle them? What are the best practices?
Any better solution for that task?
The only possibility I found was with Symfony, using config.yml files or generally YML files to store my general configuration. But what are the best practices for this kind of storage? How to securely manage them?
I hope this question is not too general.
Thank you.
Personally, for most of my bigger projects I use both file and database solutions combined together (and i know a lot of people do that).
Configuration table in database to store all parameters that can be configured via CMS / Admin Panel.
One bigger INI / YAML file to keep base configuration of the application.
Many smaller INI / YAML files for modules / functionality / routes etc.
These INI / YAML files are kept out of code versioning, changed rarely and also cached.
For getting these values inside code i use only one ConfigManager class with priorities like database value -> partial file value (dependant on module etc.) -> main file value.
P.S. YAML (native for Symfony) is really good, i wouldn't be changing it to INI if i had it already implemented.

Categories