Download the PHP package sdsdev/rest-bundle-doctrine without Composer

On this page you can find all versions of the php package sdsdev/rest-bundle-doctrine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rest-bundle-doctrine

rest-bundle-doctrine

Thanks to Philip Washington Sorst for the inital Project to fork from.

Updated Project to work with Doctrine ORM 3 and Symfony 7.1.*

About

This Symfony Bundle automatically generates Routes for all registered Doctrine ORM Entities.

It generates delete routes.

Install

Install via composer

Enable the Bundle in the config/bundles.php file of your Symfony project:

Register the routes in the config/routes.xml file of your Symfony project:

Authentication

To enable the default Symfony #[CurrentUser] Authentication on all endpoints do the flowing steps:

This will enable the basic Symfony auth on all endpoints so they can only be accessed if you are logged in.

Symfony Security Docs

Usage

After fully installing there should be routes available for all entities that are registered in the Doctrine ORM

Routes will return or take data in JSON format.

If you want to see a list of all routes use:

The entityName is the name of your entity in lowercase so UserRole would be userrole

Search

Method: POST

Request Options

Body Schema

Associations

You can freely add associations that will be loaded with the requested entity.

Associations need to be given in snake case and as a string.

Associations can be up to 2 paths deep.

Example:

User has a connected Table UserRole and we want to load it.

Our Body would look like this:

Nested associations

For nested associations you can chain them with entity.entity

e.g. if UserRoles had a connected Table permissions and we want to load them too

Our Body would look like this:

Filter

Available Filters

To get for e.x. a User with the id 1 our body would look like this

Our Body would look like this:

If we want to filter for a User with a specific Role we can also do that

This will return all users that have the UserRole with id 1.

If we want to load and filter the association simultaneously we can give the filter a mode parameter.

As of writing this doc only "mode": "full" is supported everything else will not have any impact.

So if we want to get a User that has the UserRole id 1 and the corresponding UserRole our Body looks like this:

If we want to get all UserRoles but still only Users with the UserRole.id 1 we can just remove the "mode":"full" parameter.

Sorting

We can define sortings to our entities by giving the request body a sort array.

Sample Body

Available sort orders

Pagination

Pagination is enabled by default (page: 1, perPage: 50) To control Pagination you can pass page and perPage in your request body.

Get

Method: GET

Returns an Entity with the given name and id.

Get can also use Associations see Associations above.

Insert

Method: POST

Body is a JSON representation of the object that you want to create.

If we assume you have a User Entity User has id, name, username, additionalName, a Country (ManyToOne Entity) and we got a country with id 1 in there.

Your Body to insert a new User would look like this

(If id is autoincrement you have to delete the "id" field in the json)

If a mandatory foreign key is not set the api will return an Error!

Returns 201 if successful

Update

Method: PUT/PATCH

If we assume you have a User Entity User has id, name, username and we want to update the username

Your Body to update would look like this

Returns 200 if successful

Delete

Method: DELETE

Deletes an entity with the given id.

Will return an Error if the id does not exist.

Returns 204 if successful


All versions of rest-bundle-doctrine with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
jms/metadata Version ^2.6
doctrine/orm Version ^3.1
symfony/expression-language Version 7.1.*
symfony/finder Version 7.1.*
symfony/framework-bundle Version 7.1.*
symfony/property-access Version 7.1.*
symfony/security-bundle Version 7.1.*
symfony/serializer Version 7.1.*
symfony/validator Version 7.1.*
symfony/yaml Version 7.1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sdsdev/rest-bundle-doctrine contains the following files

Loading the files please wait ....