cloudframework-io / backend-core-php8
CLOUDRAMEWORK PHP8 CORE FRAMEWORK TO DEVELOP BACKEND APIs and SCRIPTs optimized for APPENGINE, FUNCTIONS, KUBERNETS and other server technologies
Requires
- google/apiclient: ^2.15
- google/cloud-bigquery: ^1.28
- google/cloud-datastore: ^1.26
- google/cloud-logging: ^1.28
- google/cloud-pubsub: ^1.48
- google/cloud-secret-manager: ^1.12
- google/cloud-storage: ^1.36
- google/cloud-tasks: ^1.13
- google/cloud-translate: ^1.17
- zbateson/mail-mime-parser: ^2.4
- dev-main
- 8.3.38
- 8.3.37
- 8.3.36
- 8.3.35
- 8.3.34
- 8.3.33
- 8.3.32
- 8.3.31
- 8.3.30
- 8.3.29
- 8.3.28
- 8.3.27
- 8.3.26
- 8.3.25
- 8.3.24
- 8.3.23
- 8.3.22
- 8.3.21
- 8.3.20
- 8.3.19
- 8.3.18
- 8.3.17
- 8.3.16
- 8.3.15
- 8.3.14
- 8.3.13
- 8.3.12
- 8.3.11
- 8.3.10
- 8.3.9
- 8.3.8
- 8.3.7
- 8.3.6
- 8.3.5
- 8.3.4
- 8.3.3
- 8.3.2
- 8.3.1
- 8.1.23
- 8.1.22
- 8.1.21
- 8.1.20
- 8.1.19
- 8.1.18
- 8.1.17
- 8.1.16
- 8.1.15
- 8.1.14
- 8.1.13
- 8.1.12
- 8.1.11
- 8.1.10
- 8.1.9
- 8.1.8
- 8.1.7
- 8.1.6
- 8.1.5
- 8.1.4
- 8.1.3
- 8.1.2
- 8.1.1
- dev-development
- dev-fix/convert_date_fetchByKeys
- dev-feature/workflow-email-bcc
This package is auto-updated.
Last update: 2024-11-26 14:49:41 UTC
README
CLOUDRAMEWORK PHP8 CORE FRAMEWORK TO DEVELOP BACKEND APIs and BACKEND SCRIPTs optimized for GOOGLE APPENGINE, COMPUTE ENGINE, CLOUD FUNCTIONS, KUBERNETS and other server technologies.
It Assumes you have installed in your server ^PHP8.1 and ^Python3.X
Github project and Package can be found
- https://github.com/CloudFramework-io/backend-core-php8
- https://packagist.org/packages/cloudframework-io/backend-core-php8
First time Installation and running a local server with Hello World APIs
First step is to install the basic library
composer require cloudframework-io/backend-core-php8 # if you have problem with GRPC extensions you can use: # composer require cloudframework-io/backend-core-php8 --ignore-platform-req=ext-grpc
Now you need to create your basic file structure
php vendor/cloudframework-io/backend-core-php8/install.php # It will create the following structure: - mkdir ./local_data/cache - Copying /api examples - Copying /scripts examples - Copying composer.json - Copying .gitignore - Rewriting composer.json - Copying app.yaml for GCP appengine - Copying .gcloudignore - Copying README.md - Copying php.ini
NOW YOU CAN LAUNCH your LOCAL SERVER with your FIRST API Hello world
composer server # And you can add a browser and navigate to: # http://localhost:8080/ # http://localhost:8080/training/hello # http://localhost:8080/training
The response of http://localhost:8080/ will be a JSON
{ "success": true, "status": 200, "code": "ok", "time_zone": "UTC", "data": { "end-point /index [current]": "This end-point defined in <document-root>/api/index.php", "end-point /training/hello": "Advanced API Structure of Hello World in <document-root>/api/training/hello-advanced.php", "Current Url Parameters: $this->params": [], "Current formParameters: $this->formParams": [] }, "logs": [ "[syslog:info] CoreCache: init(). type: directory", "[syslog:info] RESTful: Url: [GET] http://localhost:8080/" ] }
Explore the files /api/training/hello.php and hello-advanced.php to see a basic structure of an API.
Configure your project to be deployed in GCP (Google Appengine) and/or to interact with CloudFramework CLOUD-PLATFORM
Before to setup your local development environment be sure you have installed GCP SDK in your computer.
Run the following composer command to configure your development environment to
composer setup
MAC Development Environment
If you are a mac user with zsh shell, the setup will ask you about to configure .zshrc with some variables, aliases and function to facilitate your development life.
> php vendor/cloudframework-io/backend-core-php8/runscript.php _setup
CloudFramWork (CFW) Core7.Script 8.1.x
- Looking for scripts of the framework because the name start with [_]
- root_path: /Users/adrianmartinez/Develoment/GCP/api.cloudframework.io/appengine/core24
- app_path: ./vendor/cloudframework-io/backend-core-php8/scripts
- script: ./vendor/cloudframework-io/backend-core-php8/scripts/_setup.php
- Initial Logs:
#[syslog:info] CoreSession: init(). id [CloudFrameworkScripts]
#[syslog:info] CoreCache: init(). type: directory
##########################
SHELL configuration
- current shell: [/bin/zsh]
# Do you want auto configuration of [/Users/adrianmartinez/.zshrc] [yes, no] (yes) :
If your answer is [yes] in will add some aliases and functions:
# Analyzing /Users/adrianmartinez/.zshrc
. Adding header [# BEGIN CloudFramework ALIASES AND FUNCTIONS]
. Found tag [# END CloudFramework ALIASES AND FUNCTIONS]
# Adding alias [# Cloudframework ALIASES]
# Adding alias [alias cfserve='composer run-script serve']
# Adding alias [alias cfdeploy='composer run-script deploy']
# Adding alias [alias cfcredentials='composer run-script install-development-credentials']
# Adding alias [alias cfscript='composer run-script script']
# Adding alias [alias cffront="python cf_http_dev.py 5000 'Pragma: no-cache' 'Cache-Control: no-cache' 'Expires: 0' 'Access-Control-Allow-Origin: *'"]
# Adding alias [alias cfgen_password='openssl rand -base64 21']
# Adding alias [alias cfreload_source='source ~/.zshrc']
# Adding alias [# Cloudframework Functions]
# Adding function [function gcp () {]
# Adding function [function gsecret () {]
# File updated. Execute [source ~/.zshrc]
CLOUD-PLATFORM configuration
If you are a CloudFramwork Customer you can configure your development environment connected with your Platform. Don't worry, this option is totally optional and it is nor required.
CORE ./config.json
- GCP configuration config vars
# core.erp.platform_id: CF/ERP Platform Id (empty if you do not have any access) :
Google GCP Configuration
If you are interested in deploying your APIs under APPENGINE then you need to provide GCP configuration
# core.gcp.project_id: DEFAULT PROJECT_ID for GCP (<default-project>>) : # core.gcp.datastore.on: Activate Datastore access [true, false] (false) : # core.gcp.datastore.project_id: Default project_id for datastore. Empty if it is the same than core.gcp.project_id : # core.gcp.datastorage.on: Activate Storage access [true, false] (false) : # core.gcp.datastorage.project_id: Default project_id for datastorage. Empty if it is the same than core.gcp.project_id : # core.gcp.bigquery.on: Activate Bigquery access [true, false] (false) : # core.gcp.bigquery.project_id: Default project_id for bigquery. Empty if it is the same than core.gcp.project_id : # core.cache.cache_path: Development Cache Path (<document-root>/local_data/cache) : - Updated ./config.json ########################## Script: OK