almacil/php-core 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

almacil/php-core

最新稳定版本:1.6.0

Composer 安装命令:

composer require almacil/php-core

包简介

Framework PHP para el desarrollo de aplicaciones web y APIs.

README 文档

README

GitHub last commit GitHub tag (latest by date) Packagist PHP Version Support GitHub

♥️ Almacil PHP Core

This is a simple MVC framework written in PHP for rapid development of small projects.


Do you want to contribute?
Donate 1€

Features

  • Routes
  • Internationalization
  • Database
  • Cache
  • HTTP Requests
  • Minimum dependencies

Installation

Installation is possible using Composer

composer require almacil/php-core

Usage

Create an instance of \Almacil\App:

// Require composer autoloader
require __DIR__ . '/vendor/autoload.php';

$rootDir = __DIR__;
$configFile = 'app.config.json';

// Create de instance
$app = new \Almacil\App($rootDir, $configFile);

app.config.json example

{
  "display_errors": true,
  "languages": [
    "es_ES",
    "en_GB"
  ],
  "timezone": "Europe/Madrid",

  "spa": {
    "enabled": true
  },
  "cache": {
    "enabled": true,
    "directory": "disk/cache",
    "time": 10
  },
  "database": {
    "enabled": true,
    "directory": "disk/database/",
    "extension": "json"
  },
  "http": { // Developing
    "enabled": true,
    "defaultPrefix": ""
  },
  "translate": {
    "enabled": true,
    "directory": "disk/i18n/",
    "findMissingTranslations": false
  },
  "router": {
    "enabled": true,
    "routesFile": "app.routes.json"
  },

  "environments": {
    "baseFile": "environments/base.json",
    "production": {
      "domain": "id.core.almacil.com",
      "propertiesFile": "environments/production.json"
    },
    "development": {
      "domain": "localhost:8000",
      "propertiesFile": "environments/development.json"
    }
  }
}

display_errors: true | false
Con el valor en true se mostrarán los errores de PHP, útil para depuración. En producción se recomienda ponerlo en false.

languages: array
Definimos un array con los idiomas válidos para nuestra aplicación web. Almacil Core recupera el idioma del navegador del usuario y, si es necesario, lo redirecciona para poner la abreviación del idioma en el primer segmento de la url.

timezone: string
Define el timezone de PHP.

spa: object
    enabled: true | false
    Esta funcionalidad permite navegar a través de la aplicación web sin refrescar la página.
    Más información aquí.

cache: object
    enabled: true | false
    directory: string
    time: number

SPA (Single Page Application)

Podemos hacer lo siguiente con Javascript para cambiar de página:

const route = '/contact';
captain.navigate(route);

app.routes.json example

{
  "middlewares": [
    "middlewares/variables"
  ],
  "default": {
    "responseType": "html",
    "head": "layout/head",
    "beforeContent": "layout/before-content",
    "afterContent": "layout/after-content",
  },
  "routes": [
    {
      "path": "/contact",
      "component": "pages/contact"
    },
    {
      "path": "/articles",
      "component": "pages/articles",
      "cache": {
        "enabled": false
      },
      "data": {}
    },
    {
      "path": "/articles/{article_id}",
      "component": "pages/article",
      "data": {
          "pageType": "article"
      }
    },
    {
      "path": "/",
      "component": "pages/home",
      "cache": {
        "enabled": true,
        "time": 60, // seconds
      }
    }
  ],
  "notFound": {
    "component": "pages/404"
  }
}


Writting in my spare time...



Do you want to contribute?
Donate 1€

Made with ❤️ by developer for developers

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固