Download the PHP package fphpr/fastphp without Composer
On this page you can find all versions of the php package fphpr/fastphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fphpr/fastphp
More information about fphpr/fastphp
Files in fphpr/fastphp
Informations about the package fastphp
Night Framework
A simple and lightweight framework that gives you more speed .
Install
The Basics
Input Value
Path Helper
night framework sample usage in path helper
Url Helper
url
To get and use the url address
route_url / params_url
Get route address
For example we enter the http://yoursite.com/account/login address in the browser The output will be as follows
method / isGet / isPost
Basic Controllers
pageController.php
Database
Get Start
sample for normal use query
Using Multiple Database Connections
When using multiple connections, you may access each connection via the in method on the DB facade.
Query Builder
night framework database query builder provides a convenient, fluent interface to creating and running database queries.
select
union
The query builder also provides a quick way to "union" two queries together. For example, you may create an initial query and use the union method to union it with a second query:
count
sum
join / leftJoin / rightJoin
orderBy
The orderBy method allows you to sort the result of the query by a given column.
latest / oldest
The latest and oldest methods allow you to easily order results by date. By default, result will be ordered by the created_at column. Or, you may pass the column name that you wish to sort by:
inRandomOrder
The inRandomOrder method may be used to sort the query results randomly. For example, you may use this method to fetch a random user:
groupBy / having / duplicate
The groupBy and having methods may be used to group the query results. The havingmethod's signature is similar to that of the where method:
You may pass multiple arguments to the groupBy method to group by multiple columns:
To find fields that contain duplicate information . The following code will find users whose phone numbers are duplicates
skip / take
To limit the number of results returned from the query, or to skip a given number of results in the query, you may use the skip and take methods:
Alternatively, you may use the limit and offset methods:
Insert
The query builder also provides an insert method for inserting records into the database table. The insert method accepts an array of column names and values:
Updates
In addition to inserting records into the database, the query builder can also update existing records using the update method. The update method, like the insert method, accepts an array of column and value pairs containing the columns to be updated. You may constrain the update query using where clauses:
The query builder also provides convenient methods for incrementing or decrementing the value of a given column. This is a shortcut, providing a more expressive and terse interface compared to manually writing the update statement.
Both of these methods accept at least one argument: the column to modify. A second argument may optionally be passed to control the amount by which the column should be incremented or decremented:
Delete
The query builder may also be used to delete records from the table via the deletemethod. You may constrain delete statements by adding where clauses before calling the delete method:
If you wish to truncate the entire table, which will remove all rows and reset the auto-incrementing ID to zero, you may use the truncate method:
File
upload
path / toStorage
save path file location use the path method
or path to storage
maxSize / limit_ext / limit_type
maxSize(int amount)
The maxSize method is used to limit the file size
limit_ext(array of extension)
By the limit_ext method we limit the file to its extension
limit_type(array of extension)
By the limit_type method we limit the file to its mime type
rename / randomName
rename(string name_file)
The rename method is used to save the file with the custom name
randomName()
The randomName method creates a unique name for the file. The name contains 10 random number and the time in seconds
sample name: f_25813_38893_158593089589.png
save
The save method is used to save the file to the server
code sample
status
The status method is used to check the file upload status
if the upload is done correctly Return true Otherwise return false
getErrors
Get the array of errors