Download the PHP package nicollassilva/simplephp without Composer
On this page you can find all versions of the php package nicollassilva/simplephp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package simplephp
# [DESCONTINUED] Simple PHP - Simple and easy CRUD for PHP projects
OBS: This package was replaced by the MinasORM package.
Um pequeno projeto CRUD desenvolvido para auxiliar as rotinas diárias e acelerar o processo de comunicação com o banco de dados com segurança e transparência.
A small CRUD project developed to assist daily routines and speed up the process of communicating with the database with security and transparency.
Getting Started
Some precautions and step-by-step instructions for you to download and install the package.
Prerequisites
To be able to use SimplePHP you will need to have:
Installing
SimplePHP can be installed via composer.json or via the command terminal:
or composer.json:
Connection
To configure the connection to the database, you must access: Source\Root\Config.php. Example of the file to be found:
Example of your model
After completing the database configuration, create a folder at the root of the project where your Models will be and create the class.
-
You should extend and use the SimplePHP class namespace, as in the example:
- You will need to inherit your model from the SimplePHP class, and in the magic constructor method, call the parent constructor with the name of the table for the referred model, and a primary key.
First use
After all the previous steps, create an index.php at the root of the project giving a require in the composer autoload and in your model class, after that, instantiate your model and you can start using SimplePHP. Below is an example:
Installation Errors
Some mistakes and how to fix them
Fatal error: Uncaught Error: Class 'SimplePHP\Model\SimplePHP' not found
To fix it, execute the following command in the project's root folder:
Documentation
Methods
find
- Note: except() method does not work chained with the execute(true) method, only execute() without parameter true.
-
Note: except() method only works when looking for specific information, in multidimensional arrays it does not work. This will be fixed soon.
- All methods are friendly to each other, that means you can make complex queries. Real example:
destroy
- Note: To delete an information, you need to be aware that there is a reference to that information, that is, the primary key.
save (update)
- Note: To save an information, you need to be aware that there is a reference to that information, that is, the primary key.
-
OBS: You can use the only() method to pull only the necessary information, but when editing, you can pass any column that exists in the database table and the system will proceed to treat and insert it. Example:
- OBS2: In case of failure, it will return NULL, if completed, it will return true.
create (insert)
It is also possible by passing a direct array:
- OBS2: In case of failure, it will return NULL, if completed, it will return true.
Others methods
-
Guide to the above methods:
- hashFormat: Encrypt a password using the native password_hash function.
-
urlFormat: Formats a string to a friendly url.
-
validateEmail: Validates that the email entered is valid. All true:
-
validatePassword: Checks whether the password contains an uppercase and lowercase letter, a special character, a number, if it is greater than 6 characters and less than 20.
-
validatePhone: Checks whether the phone number you entered is valid. (hyphen not required)
- aleatoryToken: Generates a random string with the given size.
Errors during Execution
When an error is generated by SimplePHP, it will appear in the directory configured in the folder configuration, the report is generated by the monolog package.
Authors
- Nícollas Silva - Developer - NicollasSilva
License
This project is licensed under the MIT License - see the LICENSE.md file for details