Giter Site home page Giter Site logo

bilemo's Introduction

Bilemo Api

Welcome on the Bilemo Api project ! This project was realized under Symfony 3.4. This project is for my training at Openclassroom on the DA PHP/Symfony path.This is my seventh project, for which I need to create a Api REST phone sales app.
For more help on how Api works, read the documentation
If you want to use the Frontend app, go here

Prerequisites

  • PHP 7.3
  • Mysql
  • Apache

Framework

  • Symfony

ORM

  • Doctrine

Bundles

  • friendsofsymfony/rest-bundle
  • csa/guzzle-bundle
  • white-october/pagerfanta-bundle
  • willdurand/hateoas-bundle
  • jms/serializer-bundle
  • doctrine/doctrine-fixtures-bundle

Getting started

Create Facebook app

Before you install the project, go to the Facebook Developers site and sign in.Then go to your space here and create a new app.

Create demo users

For create demo users, go to your Facebook app space, click on Roles and then on Test Users.Create two users with the Add button.

Installation

Clone project :

git clone https://github.com/Thibok/Bilemo.git

Install dependencies :

composer install

Create database :

php bin/console doctrine:database:create

Update schema :

php bin/console doctrine:schema:update --force

Update demo users

Go in src/AppBundle/DataFixtures/UserFixtures.php and set on lines 62 and 63 your Facebook users demo informations in this order : user ID, first name, last name

Load fixtures :

php bin/console doctrine:fixture:load

Retrieve an access token

For access to Api, you need access token.For obtain it you can use the Frontend App and sign in with your Facebook account or use a Facebook demo user.For get an access token for a demo user, go to your Facebook app space, choose an user then click on Edit and then Obtain an access token for this test user

Run It !

Now you can start your server with this :

php bin/console server:start

For your requests, remember to use the Authorization header and add your access token to Bearer (RFC 6750)

Bearer yourAccessToken
And go on the local address ! Don't forget to read the documentation

Tests

If you need run tests :

Create test database :

php bin/console doctrine:database:create --env=test

Update schema :

php bin/console doctrine:schema:update --force --env=test

Create a test app

Go to your Facebook app space and click on Create a test app

Create test users

Always in your Facebook app space, create two tests users in your test app and obtain access token for them.

Update tests user

Go in app/config/parameters.yml and set fb_test_main_access_token and fb_test_secondary_access_token with access tokens of your test users

Go in src/DataFixtures/UserFixtures.php and set on lines 54 and 55 your Facebook users test informations in this order : user ID, first name, last name

Load test fixtures :

php bin/console doctrine:fixture:load --env="test"

Run tests !

vendor/bin/phpunit

Production

If you want to use production environment, don't forget :

Clear cache :

php bin/console cache:clear --env="prod"

bilemo's People

Contributors

thibok avatar

bilemo's Issues

Consult a phone

Consult a phone

-- Create route (/phones/{id}) [GET]
-- Add viewAction (PhoneController method)
-- Make tests

Estimation

-- 1h

Add customer

Add customer

-- Create route (/customers) [POST]
-- Create Customer (Entity)
-- Create CustomerRepository (Repository)
-- Create RessourceValidationException (Exception)
-- Create CustomerController (Controller)
-- Add addAction (CustomerController method)
-- Make tests

Estimation

-- 3h

Authentication

Authentication

-- Create User (Entity)
-- Create FacebookClient (Client)
-- Create FacebookRequester (Requester)
-- Create UserManager (Manager)
-- Create FacebookUserProvider (Provider)
-- Create FacebookAuthenticator (Authenticator)

Estimation

-- 3h

Delete customer

Delete customer

-- Create route (/customers/{id}) [DELETE]
-- Add deleteAction (CustomerController method)
-- Make tests

Estimation

-- 2h

Consult customers

Consults customer

-- Create route (/customers) [GET]
-- Create Customers (Representation)
-- Add listAction (CustomerController method)
-- Make tests

Estimation

-- 2h

Consult phones

Consult phones

-- Create route (/phones) [GET]
-- Create AbstractProduct (Entity)
-- Create Phone (Entity)
-- Create PhoneRepository (Repository)
-- Create AbstractRepository (Repository)
-- Create ExceptionNormalizerPass (Compiler)
-- Create NormalizerInterface (Normalizer)
-- Create AbstractNormalizer (Normalizer)
-- Create DoctrineExceptionNormalizer (Normalizer)
-- Create ExceptionListener (Listener)
-- Create Phones (Representation)
-- Create PhoneController (Controller)
-- Add listAction (PhoneController method)
-- Make tests

Estimation

-- 3h

Consult a customer

Consult a customer

-- Create route (/customers/{id}) [GET]
-- Add viewAction (CustomerController method)
-- Make tests

Estimation

-- 1h

[Moved][Frontend] Client space

Client space

-- Create route (/space) [GET]
-- Create ClientSpaceController (Controller)
-- Add spaceAction (ClientSpaceController method)
-- Make tests

Estimation

-- 2h

[Moved][Frontend] Authentication

Authentication

-- Create route (/) [GET]
-- Create SecurityController (Controller)
-- Add loginAction (SecurityController method)
-- Create login.html.twig (Security Twig view)
-- Create User (Entity)
-- Create FacebookClient (Client)
-- Create FacebookRequester (Requester)
-- Create UserManager (Manager)
-- Create FacebookUserProvider (Provider)
-- Create FacebookAuthenticator (Authenticator)
-- Make tests

Estimation

-- 8h

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.