PHP Classes

PHP Web Server Configuration Policy Maker: Generate Web server configuration from a policy

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 75 All time: 10,164 This week: 560Up
Version License PHP version Categories
policymaker 1.0.0GNU General Publi...5PHP 5, Systems administration, Config...


This package can generate Web server configuration from a policy.

It can take an array with options that define policy parameters like denying or allowing access to the content of a given Web server directory files.

The class can generate configuration files for different Web servers to comply with policy configuration parameters.

Innovation Award
PHP Programming Innovation award nominee
January 2022
Number 3
Every Web application needs to have configured a Web server to serve the application pages using PHP.

The configuration files and option values depend on the type of Web server that the Web application uses.

This package simplifies the creation of Web server configuration files for different Web servers using a single PHP script.

Manuel Lemos
Picture of Ali YILMAZ
  Performance   Level  
Name: Ali YILMAZ <contact>
Classes: 16 packages by
Country: Turkey Turkey
Age: ???
All time rank: 249542 in Turkey Turkey
Week rank: 249 Up15 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 8x


What is policyMaker ?

This package serves to create custom access policies for server software. Apache, Microsoft ISS, LiteSpeed and Nginx software are supported.

Out-of-class use:


$m = new Mind([
        'allow'=>'public' // or array

When using it in the class:


self::$conf = [
        'allow'=>'public' // or array

Out-of-class use:


$m = new Mind();
// $m::aliyilmaz('policyMaker')->setAllow('public')->policyMaker();
// $m::aliyilmaz('policyMaker')->setDeny('developer')->policyMaker();
// $m::aliyilmaz('policyMaker')->setDeny('developer')->setAllow('public')->policyMaker();
// $m::aliyilmaz('policyMaker')->setDeny(['developer', 'app'])->setAllow(['public', 'files'])->policyMaker();

When using it in the class:


// self::aliyilmaz('policyMaker')->setAllow('public')->policyMaker();
// self::aliyilmaz('policyMaker')->setDeny('developer')->policyMaker();
// self::aliyilmaz('policyMaker')->setDeny('developer')->setAllow('public')->policyMaker();
// self::aliyilmaz('policyMaker')->setDeny(['developer', 'app'])->setAllow(['public', 'files'])->policyMaker();


Server access files are created by server software type. 
Blocking access to directories is always a priority. 
Therefore, if a conflicting directory is detected in the directory definitions, access is denied. 
Access to directories that are not specifically allowed is always blocked.

For Nginx: The following steps should be applied only for Nginx, there is no need for intervention in other server software. Add the following rules to the server {} container in the .conf file that affects the project and restart the server. You need to enter the directories whose access you will restrict in the parenthesis in the location ~ /(app)/ section with | separator such as (app|special).

error_page 404 /index.php;
location / {
    try_files $uri $uri/ /index.php$is_args$args;
    autoindex on;
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass php_upstream;		
location ~ /(app)/ {
    deny all;
    return 403;


  1. getSoftware 1.0.1
  2. write 1.0.1


Instructions and files in this directory are shared under the GPL3 license.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file policyMaker.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,164
This week:560Up
User Comments (1)
Thats a good class ! Take care thats a little bug in setAllo...
2 years ago (Josť Filipe Lopes Santos)