Giter Site home page Giter Site logo

dynamic_api's Introduction

ArbitrarilyTong's dynamic RESTful API server

Use for OTA Updates checking

Setting up the app

1. Use composer to install environment before you use or develop it

composer install —no-dev

2. Allow PHP functions

You need to allow putenv

3. Create a file named .env

###> symfony/framework-bundle ###
#If your symfony didnt load normal you can change APP_ENV to dev,then you can get more detailed error log
APP_ENV=prod 
APP_SECRET=
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# MySQL:
# DATABASE_URL="mysql://username:[email protected]:3306/database_name?serverVersion=8&charset=utf8mb4"

###< doctrine/doctrine-bundle ###

You can change the MySQL version in .env,please visit Symfony document to learn more

4. Create a MySQL database and use MySQL commands to initialize the database

Please run these commands in MySQL console

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

CREATE TABLE IF NOT EXISTS configs (
  id int(11) NOT NULL AUTO_INCREMENT,
  name longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  value longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO configs (id, name, value) VALUES
  (1, 'donate_url', 'https://get.pixelexperience.org/donate/'),
  (2, 'website_url', 'https://get.pixelexperience.org/'),
  (3, 'news_url', 'https://t.me/PixelExperience');

CREATE TABLE IF NOT EXISTS doctrine_migration_versions (
  version varchar(191) COLLATE utf8_unicode_ci NOT NULL,
  executed_at datetime DEFAULT NULL,
  execution_time int(11) DEFAULT NULL,
  PRIMARY KEY (version)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO doctrine_migration_versions (version, executed_at, execution_time) VALUES
  ('DoctrineMigrations\\Version20230520062350', '2023-05-20 17:00:51', 108),
  ('DoctrineMigrations\\Version20230520083612', '2023-05-20 17:10:48', 92),
  ('DoctrineMigrations\\Version20230520083839', '2023-05-20 17:20:58', 105),
  ('DoctrineMigrations\\Version20230520092412', '2023-05-20 17:24:25', 28),
  ('DoctrineMigrations\\Version20230520092715', '2023-05-20 17:29:03', 75),
  ('DoctrineMigrations\\Version20230520093037', '2023-05-20 17:31:08', 83),
  ('DoctrineMigrations\\Version20230520093420', '2023-05-20 17:34:25', 126);

CREATE TABLE IF NOT EXISTS ota (
  id int(11) NOT NULL AUTO_INCREMENT,
  name1 longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  name2 longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  filename longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  size bigint(20) NOT NULL,
  url longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  version longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  filehash longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  maintainers longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '(DC2Type:array)',
  info_id longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  datetime datetime NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO ota (id, name1, name2, filename, size, url, version, filehash, maintainers, info_id, datetime) VALUES
  (1, 'name1A', 'name2A', 'filename', 114514, 'url', 'version', 'filehash', 'a:2:{i:0;s:11:"maintainer1";i:1;s:11:"maintainer2";}', 'id', '1970-01-23 13:16:50');

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;

5. Setting up rewrite rules

If you are using Apache,you can skip this step,because .htaccess is ready for you

If you are using Nginx,please write these rewrite rules in your Nginx config file

	location / {
        # try to serve file directly, fallback to index.php
        try_files $uri /index.php$is_args$args;
    }

dynamic_api's People

Contributors

reallanta avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.