Code Monkey home page Code Monkey logo

core's Introduction

PSFS

Build Status Latest Stable Version Total Downloads Scrutinizer Code Quality Code Coverage

Framework Php Simple Fast & Secure

Requirements:

  • php 8.0+
  • ext-gettext
  • ext-json
  • ext-curl
  • ext-gmp
  • ext-fileinfo

Components that PSFS install:

"propel/propel": "2.0.x-dev",
"symfony/console": "v6.x",
"symfony/finder": "v6.x",
"symfony/translation": "v6.x",
"twig/twig": "3.8.0",
"monolog/monolog": "3.x",
"matthiasmullie/minify": "1.3.71"

How to install using composer:

Install composer via: GetComposer

composer require psfs/core
./vendor/bin/psfs psfs:create:root
php -S 0.0.0.0:8080 -t ./html

How to use with Docker

docker-compose up .

Your could use some environment variables to manage the docker containers

- APP_ENVIRONMENT: (local|dev|...|prod) Define the staging for the run environment
- HOST_PORT: 8001 Define the port where you could expose the server
- DEBUG: -xdebug Loads a docker image with xdebug installed and configured, if empty it loads a default php image

RoadMap:

* Framework documentation
    - PhpDoc for all files
* Testing
    - 100% tests coverage

core's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

core's Issues

Bulk insert

Allow users insert multiple row in one request

[Insight] Files should not be executable

Your project contains files with permissive permissions. In order to avoid opening a security breach, you should restrict execution rights on following files:

  • LICENSE
  • README.md
  • composer.json
  • src/Dispatcher.php
  • src/autoload.php
  • src/base/Logger.php
  • src/base/Request.php
  • src/base/Router.php
  • src/base/Security.php
  • src/base/Singleton.php
  • src/base/Template.php
  • src/base/config/AdminForm.php
  • src/base/config/Config.php
  • src/base/config/ConfigForm.php
  • src/base/config/LoginForm.php
  • src/base/config/ModuleForm.php
  • src/base/exception/ConfigException.php
  • src/base/exception/FormException.php
  • src/base/exception/LoggerException.php
  • src/base/extension/AssetsNode.php
  • src/base/extension/AssetsParser.php
  • src/base/extension/AssetsTokenParser.php
  • src/base/lib/CssMinifier.php
  • src/base/lib/JsMinifier.php
  • src/base/types/Controller.php
  • src/base/types/Form.php
  • src/base/types/interfaces/AuthInterface.php
  • src/base/types/interfaces/ControllerInterface.php
  • src/bootstrap.php
  • src/templates/admin.html.twig
  • src/templates/base.html.twig
  • src/templates/forms/base.html.twig
  • src/templates/forms/button.html.twig
  • src/templates/forms/field.html.twig
  • src/templates/generator/autoloader.template.twig
  • src/templates/generator/controller.template.twig
  • src/templates/generator/index.template.twig
  • src/templates/index.html.twig
  • src/templates/login.html.twig
  • src/templates/modules.html.twig
  • src/templates/redirect.html.twig
  • src/templates/routing.html.twig
  • src/templates/welcome.html.twig
chmod a-x 'LICENSE' \
    'README.md' \
    'composer.json' \
    'src/Dispatcher.php' \
    'src/autoload.php' \
    'src/base/Logger.php' \
    'src/base/Request.php' \
    'src/base/Router.php' \
    'src/base/Security.php' \
    'src/base/Singleton.php' \
    'src/base/Template.php' \
    'src/base/config/AdminForm.php' \
    'src/base/config/Config.php' \
    'src/base/config/ConfigForm.php' \
    'src/base/config/LoginForm.php' \
    'src/base/config/ModuleForm.php' \
    'src/base/exception/ConfigException.php' \
    'src/base/exception/FormException.php' \
    'src/base/exception/LoggerException.php' \
    'src/base/extension/AssetsNode.php' \
    'src/base/extension/AssetsParser.php' \
    'src/base/extension/AssetsTokenParser.php' \
    'src/base/lib/CssMinifier.php' \
    'src/base/lib/JsMinifier.php' \
    'src/base/types/Controller.php' \
    'src/base/types/Form.php' \
    'src/base/types/interfaces/AuthInterface.php' \
    'src/base/types/interfaces/ControllerInterface.php' \
    'src/bootstrap.php' \
    'src/templates/admin.html.twig' \
    'src/templates/base.html.twig' \
    'src/templates/forms/base.html.twig' \
    'src/templates/forms/button.html.twig' \
    'src/templates/forms/field.html.twig' \
    'src/templates/generator/autoloader.template.twig' \
    'src/templates/generator/controller.template.twig' \
    'src/templates/generator/index.template.twig' \
    'src/templates/index.html.twig' \
    'src/templates/login.html.twig' \
    'src/templates/modules.html.twig' \
    'src/templates/redirect.html.twig' \
    'src/templates/routing.html.twig' \
    'src/templates/welcome.html.twig'

Posted from SensioLabsInsight

Curl in Service

It would be interesting to have methods to get info (curl_getinfo) and errors (curl_error, curl_errno) from the curl connection.
On the other hand, it's a bit confusing headers property in Service because it's used for nothing; it seems to be here to configure headers like CURLOPT_HTTPHEADER but this has to be configured as an option.

Allow to use lowerCamelCase in API responses

Actually API returns JSON objects using UpperCamelCase:
{
"IdAddress": 0,
"Address": "string",
"City": "string",
"Province": "string",
"State": "string",
"PostalCode": "string",
}

It would be nice to have a configuration parameter to use lowerCamelCase instead:
{
"idAddress": 0,
"address": "string",
"city": "string",
"province": "string",
"state": "string",
"postalCode": "string",
}

Add locale argument to t() function

Allow to send a locale to the translator function t(). In the CustomTranslateExtension, just check if the argument is not null before setting the locale to get the translation:
self::$locale = I18nHelper::extractLocale(Security::getInstance()->getSessionKey(I18nHelper::PSFS_SESSION_LANGUAGE_KEY));

Service

It'd be interesting that base/Service class allows xml request (apart from json and parameters chain ones) since nowadays it doesn't; going a little bit further, the result is always decoded supposing that it's always returned encoded (json).

Form field validations

There's an issue in the function isValid inside src/base/types/Form.php. It's only taken into account the last field in order to validate the form; also the token field is checked twice, one at the beginning of the function and another along with the rest of the fields, so that if the token field is valid, the whole form will be valid.

PSFS doesn't work with [email protected]

Describe the bug
PSFS doesn't work with [email protected]. It fails with error:
PHP Fatal error: Trait 'PSFS\base\types\traits\SingletonTrait' not found in .../vendor/psfs/core/src/base/Logger.php on line 30

Seems something related to the psr-4 section of composer.json of PSFS.

To Reproduce
Steps to reproduce the behavior:

  1. Install PHP 7.4
  2. Open any project.
  3. Run local server.
  4. Make an API request and see error.

Expected behavior
Local server runs without issues.

Screenshots

Desktop (please complete the following information):

  • OS: MacOS Big Sur 11.2.1 M1

Additional context

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.