2017 © Pedro Pelรกez
 

project strukt

Strukt Project

image

strukt/strukt

Strukt Project

  • Wednesday, July 11, 2018
  • by pitsolu
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Strukt

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Getting started

composer create-project strukt/strukt:1.1.8-alpha --prefer-dist

Listing console commands:, (*2)

./xcli -l

Generate Application

./xcli app:make payroll

The file structure generated should look as below:, (*3)

app
โ””โ”€โ”€ src
    โ””โ”€โ”€ Payroll
        โ”œโ”€โ”€ AuthModule
        โ”‚ย ย  โ”œโ”€โ”€ Controller
        โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ User.php
        โ”‚ย ย  โ”œโ”€โ”€ Form
        โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ User.php
        โ”‚ย ย  โ”œโ”€โ”€ PayrollAuthModule.php
        โ”‚ย ย  โ”œโ”€โ”€ Router
        โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Auth.php
        โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Index.php
        โ”‚ย ย  โ””โ”€โ”€ Tests
        โ”‚ย ย      โ””โ”€โ”€ UserTest.php
        โ””โ”€โ”€ User.php # Models are stored in the root of your app (i.e payroll)

There is a default module i.e AuthModule when you generate an application. Folders generated in a module (facets) can be changed in cfg/module.ini this also indicates part of alias used to access classes/objects. You'll also find a config file cfg/app.ini that holds the active application name., (*4)

When an application or module is created/generated it is loaded by running the command below, otherwise strukt won't detect it:, (*5)

./xcli app:reload

The above command will create a App/Loader.php in the lib/ folder at the root of your project. This file should NEVER be edited because everything will be overwritten once the above command is rerun., (*6)

Generate Module

Command syntax for generating a module:, (*7)

./xcli make:module <app_name> <module_name> <module_alias>

Example command:, (*8)

./xcli make:module payroll human_resource hr

Now the file structure should look as below:, (*9)

app/
โ””โ”€โ”€ src
    โ””โ”€โ”€ Payroll
        โ”œโ”€โ”€ AuthModule
        โ””โ”€โ”€ HumanResourceModule

Remember to run the app:reload command to load the module., (*10)

Execute Shell

strukt-strukt uses Psysh., (*11)

To drop into shell:, (*12)

$ ./xcli shell:exec
> ls
Variables: $core
> $core->get("au.ctr.User")
= Payroll\AuthModule\Controller\User

> $core->get("User")
= Payroll\User {
    +username: null,
    +password: null,
  }

Cli

View providers and middlewares, (*13)

./xcli sys:ls middlewares # view for console

View index.php middlewares, (*14)

./xcli sys:ls middlewares --idx # view for index.php

You can also view providers by replacing middlewares, (*15)

Cli Utility

Enable and disable commands , middlewares and providers, (*16)

Example:, (*17)

./xcli sys:util enable commands pub-make

Run Application

./xcli app:exec

Uses .env server_{var} variables to run application., (*18)

Notes

The make:router and make:module commands will not work on cli console until you run app:make and app:reload commands are run respectively., (*19)

IMPORTANT: The folder .tpl/ in the root of the project contains sgf/ folder that contains class template files used to generate the application modules and migrations. Ensure to NOT change it until you've understood strukt-generator, (*20)

Have a good one!, (*21)

The Versions

11/07 2018

dev-master

9999999-dev

Strukt Project

  Sources   Download

MIT

The Requires

 

by Moderator