In this tutorial we will implement the repository pattern in Laravel. Repository contains the logic on how data is persisted and how to query the data. It will be most useful to avoid duplicate codes that execute the same queries and hide the complication from the code that wants the data.
When authenticating to OAuth, the access token is usually short lived and expires after a few hours or minutes. Some apps will want to use the refresh_token grant to refresh the access token to keep the user logged in. In this tutorial we will create an Angular app and with keep-alive using @ng-core, @ng-keepalive, and angular-2-storage for storing tokens.
In this tutorial we will create an Angular application that authenticates to an OAuth2 server with Authorization Code flow. The app will redirect to the OAuth2 server's login page. After logging in, the user will be redirected back to the app and get access token and refresh token.
OAuth2-Server is quite a popular package for implementing OAuth authentication for Node JS but the examples provided on express-oauth-server on GitHub is outdated and does not work. In this tutorial we will create an OAuth 2 server using Express JS and test using postman
In this tutorial we will use Swagger UI to create documentation for our Lumen or Laravel API. We will create a command that generates the swagger JSON file and a page to render the documentation. Then we will write basic phpdoc blocks and annotations.
In this tutorial, we will install PHP League's Fractal and write helper methods to transform models into arrays which can be turned into JSON. Fractal also formats the array using JSON API standard https://jsonapi.org. It can also load related objects in one request. In this project, we will use Lumen as our code base.
In this tutorial we will install Laravel Passport to a Lumen project. Laravel Passport does not work out of the box with Lumen. If you don't want to do these steps just to make it work then maybe you should consider using a composer package.
In this tutorial we will make a base view-model to easily map request body to the view-model's properties. View-models helps you present data to your views or response that cannot be presented with your existing models and it also helps clean up your controller from view logic. You could also transfer the validation logic from your controller to your view-models.
For some reason you want to upload Laravel codes on a shared hosting. Maybe just to upload a sample application, a prototype, or you don't want to use a cloud based hosting like Digital Ocean and find a cheaper hosting. In this tutorial we will go through the steps on how to upload a Laravel Application to a cPanel.
In Angular 4 we use HttpClient to perform AJAX request. HttpClient does help with type hints unlike the old Http but it does not really map to a typed object, it only returns a JavaScript object. In this tutorial we will use decorators to help with mapping properties. With this technique we don't have to map every JSON response from AJAX to typed objects, we just decorate properties of a class.