Download the PHP package packagit/starter without Composer

On this page you can find all versions of the php package packagit/starter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package starter

Packagit Starter

starter 作为新项目的基础工程,与 laravel 8.0 分支同步更新.

starter 里面集成了若干常用的基础能力:

✔️ 微信APP/小程序/H5 的登录授权

✔️ 微信支付

✔️ 苹果登录授权

✔️ modules/Components/Common/Models/BaseModel.php

✔️ modules/Components/Common/Http/Controllers/BaseController.php

可以通过 php artisan route:list --path=api 查看暴露的API列表,相关API使用参考:

https://artisansoft.feishu.cn/docs/doccnbinoOr0qUXOI00OMEMaqQg

Auth 授权模块

API token 目前集成的是 sanctum,可以根据需要增加 JWT, passport 等支持,修改 API token 逻辑需要调整的位置:

1、修改 config/auth.php 中的 guards.api.driver:

2、修改 modules/Auth/Models/User.php 中 getUserToken 方法

3、修改授权登录返回的 JSON 格式

修改文件 modules/Auth/Http/Resources/TokenResource.php

BaseModel

新建 model 需继承 BaseModel,内含日期相关的 Carbon 的日期格式化,如果需要返回字符串日期时,需要指定 string 类型, 如 (string)$user->created_at.

BaseController

新建的 Controller 需继承 BaseController, Controller 类里直接 $this->ok(), $this->error().

因为注入了 Macro, Controller 类外可以用 response()->ok(), response()->error(),使用方法一致。

常规JSON数据返回可直接用 response()->json,较复杂情况可以配合 Resource 的使用:

response()->json(TokenResource::make($user));

只返回成功或者失败的错误信息,可以使用封装:

$this->ok('您的密码已更新成功');
// or
$this->error('用户注册失败');

特殊约定使用参考:

return app(BaseController::class)
    ->ok('Apple 授权成功,还差最后一步', 1403, [
        'provider'  => $oauthUser->provider,
        'search_by' => $oauthUser->getTable(),
        'search_id' => encrypt($oauthUser->id),
    ]);

基础用户 Model

进入 modules/Auth/Models 目录下查看.

1、IUserFlexible.php:

用户 Model 的 interface 定义,当需要自定义 User Model 时,需要 implement IUserFlexible

2、User.php

用户 Model,里面封装了基础功能

3、UserMeta.php

对 user_metas 表是对 users 表的扩展,user 不太频繁的属性字段定义可以放在 user_metas 表,频繁常用的小字段放在 users 表.

重要规范说明

starter 工程使用模块化,也就是根据功能来封装模块,也可以叫做插件化。

modules/Components/* 的作用,是模块间通用的组件封装,放在这个目录里。

modules/*,是各个模块,按需添加使用, 其中 Auth, Wechat 是常规模块,工程中经常会用到的。


All versions of starter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
guzzlehttp/guzzle Version ^7.2
laravel/framework Version ^9.19
laravel/sanctum Version ^3.0
laravel/tinker Version ^2.7
wikimedia/composer-merge-plugin Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package packagit/starter contains the following files

Loading the files please wait ....