承接 mafuth/php-cli 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mafuth/php-cli

Composer 安装命令:

composer require mafuth/php-cli

包简介

About simple command line interface and framework for PHP focuesed on light weight and simplicity

关键字:

README 文档

README

Contributors Forks Stargazers Issues


php-CLI

This project requires PHP as an executable command

Installation

  1. Create a project
    composer create-project mafuth/php-cli:dev-main test
  2. Check for installation
    php cli --v
  3. Configure the installation
    php cli --config
  4. test connection to database
    php cli test data-base-connection
  5. Start a local server
    php cli --serve

ajax folder

This is where cli generates ajax request files

comands folder

This is where cli generates all you run command files

database folder

inside database/create is all the cli generates database table controllers

handlers folder

This is where cli generates handle files

views folder

This is where you put you php code files that generate views on the front end

index and main files

Please do not edit these files as these are important components

requests file

This file handles all the requests to the server, edit this file as needed

To disable minification change request file compiler like shown below

echo $COMPILER->output($PAGE,false);

If you want to use blade templating engine you can check documentation of BladeOne

config.ini file

This is the main config file of the server

[app configs]
appname = "Your App Name"
port = "8080" #Your app port default to 8080

[database configs]
servername = "Your database server here"
username = "server username"
password = "server password"
dbname = "database name"

[Mail server]
mailServer = "Your mailserver here"
mailUsername = "server username"
mailPassword = "servr password"
mailport = "server port"

[encryption keys]
KEY_ONE = "encryption key 1"
KEY_TWO = "encryption key 2"

[maintanance mode]
maintanance = false # true or false

[error reporting]
error = false # true or false

[auto ssl]
autossl = false # true or false (true will force ssl on every request)

Usage

git commands

  1. Configure git
git config --global user.name "Full Name as on github"
git config --global user.email "Email as on github"

On the next step press Enter to choose the default value

ssh-keygen -t rsa -C "Email as on github"

windows

notepad ~/.ssh/id_rsa.pub

mac & linux

cat ~/.ssh/id_rsa.pub

Now go to https://github.com/settings/keys and add the key you just generated / opened on note pad , save the ssh keys

  1. Test git
ssh -T git@github.com

If you see a message like 'Hi user! You've successfully authenticated, but GitHub does not provide shell access.' then everything is okay

php cli --git

create command

Create a database table (replace '-- your table name --' with any name of your choice)

php cli create table -- your table name --

Create a handler for post request (replace '-- your handler name --' with any name of your choice)

php cli create handler -- your handler name --

Create a ajax request handler for all xml requests (replace '-- your handler name --' with any name of your choice)

php cli create ajax -- your handler name --

Create a new run command (replace '-- your command name --' with any name of your choice)

php cli create run-command -- your command name --

Data base tables command

Drop all tables and delete create function files

php cli drop-tables

or use

php cli drop-table -- your table name --

if want edit a table layout just edit the table lay out file at (database/create) directory and run the command below

php cli recreate-tables

or use

php cli recreate-table -- your table name --

run command

This command is used to run scripts created using (php cli create run-command -- your command name -- )

php cli run -- your command name --

building Database queries ( reffer to 'classes/db.class.php' )

select from

$DB->selectFrom($table);
$data = $DB->execute(); // this will return an array of all data selected;

select from where

$DB->selectFrom($table);
$DB->where(array(
  'id'=>1,
  'name'=>array(
      'john',
      'doe'
  )
));
$data = $DB->execute(); // this will return an array of all data selected;

delete from

$DB->deleteFrom($table);
$DB->where(array(
  'id'=>1,
  'name'=>array(
      'john',
      'doe'
  )
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

update from

$DB->updateFrom($table);
$DB->set(array(
  'name'=>'john'
));
$DB->where(array(
  'id'=>1
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

insert to

$DB->insert(array(
  'john'
));
$DB->to($table);
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

$DB->insertTo($table,array(
  'name'=>'john'
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

PWA command

This command is used generate PWA code for ur website this command requires node js and pwa asset generator by onderceylan
PWA also supports onesignal SDK which is also included in php-CLI

php cli pwa-code

Composer commands

Install new composer packeges (replace '-- package name --' with any composer package of your choice)

php cli install -- package name --

Ftp deploy from github

Setup github workflow to easily deploy your websites to your servers using ftp or sftp

php cli --git make ftp deploy
php cli --git make sftp deploy

Docker

Setup a full docker enviroment for development

php cli make docker container

Database Backup

Backup your database

php cli db backup

restore your database from backup

php cli db restore

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

mafuth/php-cli 适用场景与选型建议

mafuth/php-cli 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 54 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「template」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mafuth/php-cli 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mafuth/php-cli 我们能提供哪些服务?
定制开发 / 二次开发

基于 mafuth/php-cli 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-17