2017 © Pedro Peláez
 

project atsilex

image

atphp/atsilex

  • Sunday, October 11, 2015
  • by andytruong
  • Repository
  • 1 Watchers
  • 2 Stars
  • 89 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 6 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Modular Silex Build Status

Built-ins features

  1. Twig/Bootstrap/Google analytics/…

- Doctrine Cache, DBAL, ORM - BernardPHP message queue - SF2 Console (make your command as service, name it as anything.command.the_name, then run php cli.php, you see your command is auto registered) - Module system, check ./modules/system as example. - Swagger UI, (*1)

Usage

Require atphp/atsilex in your project's composer.json file:, (*2)

{
  "name": "v3knet/website",
  "require": {
    "atphp/atsilex": "^0.2.0"
  },
  "scripts": {
    "post-install-cmd": [
      "atsilex\\module\\system\\commands\\InstallerScript::execute"
    ]
  },
  "extra": {
    "atsilex": {
      "%site_name%": "My Project",
      "%site_version%": "1.0-dev",
      "%site_url%": "http://www.vendor-name.com/",
      "%site_frontpage%": "hello",
      "%site_ga_code%": "UA-1234567-890",
      "%vendor_name%": "Vendor Name"
    }
  }
}

On composer install atsilex will setup default structure for for your application:, (*3)

files/                   # Directory to store temporary files (cache, compiled templates, …)
config.default.php       # (*) Default 
config.php               # The file that return configuration for application.
public/                  # Document root
      /index.php         # (*) Front controller
      /assets/modules/*  # Symlinks for modules's assets
                         # Don't edit (*), they will be overwritten in next composer install.

Write custom module

A module is basically a class which extends atsilex\module\Module. Each module can:, (*4)

  1. Define custom services

- Define new routes - Define new commands - Listen to system events, (*5)

Define a module is simple, you also need tell the application about your module — edit config.php, include your modules there:, (*6)

return [
    // …
    'modules' => [
        'my_module' => 'MyModule',
        'system'    => 'atsilex\module\system\SystemModule', # Can't disable
    ],
    // …
];

Configure database connection

Default database for application is a SQLite file, it's auto created in files/app.db when we run php public/index.php orm:schema-tool:create command., (*7)

To change default config for database connection, in config.php, add code similar to this:, (*8)

# SQlite
# $db_options = ['driver' => 'pdo_sqlite',  'path' => '/alternative/path/to/app.db'];

# MySQL
$db_options = [
    'driver'    => 'pdo_mysql',
    'host'      => 'mysql_write.someplace.tld',
    'dbname'    => 'my_database',
    'user'      => 'my_username',
    'password'  => 'my_password',
    'charset'   => 'utf8mb4',
];

return [
 // …
 'db.options' => $db_options,
 // …
];

The Versions