定制 apronprof/smantu 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

apronprof/smantu

最新稳定版本:v1.2.4

Composer 安装命令:

composer create-project apronprof/smantu

包简介

php framework

README 文档

README

SmantU is a free open source php framework with machine learning opportunities.

Getting started

Download the files from the main branch using

git clone apronprof/smantu

run

composer install

you're up to work.

File structure

app

This folder will contain controllers, models and middlewares you create.

config

This folder is used for giving the framework data about your app, database and middlewares and urls.

core

You must never touch this folder, there are core files located inside of it.

db

This folder is meant to be used for keeping migrations and file databases (sqlite3).

public

There are views and assets in this folder.

vendor

Composer folder.

CLI

php console app:controller Name

creates a NameController.php file for a controller with base structure in app

php console app:model Name

creates a Name.php file for a model with base structure in app

php console db:migration Name

creates a Name.php file with base structure in db/migrations

php console db:migrate

Activates all the migrations created

php console db:rollback

activates the rollback function of each migration

php console ml:trainer Name

creates a new Name.php model trainer in ml/trainers

php console ml:train Name

initiates the train for a trainer called Name.php

php console app:middleware Name

creates a new Name.php middleware

Routes

Routes are located in config/urls.php

By default the file with routes looks like this:

image

You can create new routes by using the methods get() and post() of the object $router. The method takes 2 parameters (route and controller). route must look like this 'shop/items' without slashes at the start and the end of a string.

The second parameter have to look like 'name_of_the_controller@name_of_the_method'.

the third parameter is for middlewares [new \App\Middlewares\HttpMethodMiddleware(), ...]

In order to use parameters in url you need to use {} around the name of a parameter. (For example 'users/{id}'). The parameter will be in the array $parameters that will be given as the first parameter to your controller.

Use the method _404 to choose a controller and its method for handling unknown routes. It takes only one parameter that is controller.

We're not done with this tutorial

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-30