Things like maintenance, website background, website title, favicon etc., where would it be best to store them? It would be single array of items. Do I just write it in flat CSV file, flat XML file, or use database for it (sounds pretty stupid to create single-row-table)?

(sorry for mess with tags, no idea how this question could be tagged)

Recommended Answers

All 2 Replies

It's up to you. I use arrays, like:

<?php

    return [
            'paths' => [
                'images' => '/path/to/images/directory/',
                'styles' => '/path/to/styles/directory/',
                # ...
            ],

            # ...
        ];

And/or dotenv: https://github.com/vlucas/phpdotenv

One option is what cereal suggested that it may also be the most popular in PHP world. If you separate your source code from your public files and you have your src folder not in public_html (www) another option is to use a JSON format file for configurations.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.