Connect with us

PHP 7.4 is now Released read what's new

kizinho

Published

on

Follow
NEWS: PHP 7.4 is now Released read what's new [New  Developer] » Naijacrawl
Photo: Naijacrawl
site

PHP 7.4 is a new game-changer, PHP 7.4 has added for and clean PHP syntax for easy to read.

Some of the highlights of this release that we’ve covered before include:

  • Short Arrow Functions
  • Spread Operator for Arrays
  • Typed Properties

Here is a list of all the main new features:

  • Typed Properties
  • Arrow Functions
  • Limited Return Type Covariance and Argument Type Contravariance
  • Unpacking Inside Arrays
  • Numeric Literal Separator
  • Weak References
  • Allow Exceptions from __toString()
  • Opcache Preloading
  • Several Deprecations
  • Extensions Removed from the Core

For source downloads of PHP 7.4.0 please visit the PHP downloads page and the list of changes are in the ChangeLog.

There is also a migration guide available in the PHP Manual that includes a detailed list of new features and backward incompatible changes.

 

site


kizinho

I am a software developer, like meeting people and love blogging, that's why I developed naijacrawl because that's what I love doing.

Continue Reading
Click To Comment

BE First To Comment


    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Laravel 5.8.8 Released (bugs fixed and new features )

    kizinho

    Published

    on

    NEWS: Laravel 5.8.8 Released (bugs fixed and new features ) [New  Developer] » Naijacrawl
    Photo: Naijacrawl

    The Laravel team released Laravel 5.8.8 yesterday with a new query builder method along with the latest fixes and changes in the 5.8 branch.

     

    First, a new Builder::forPageBeforeId() method was added to compliment an existing forPageAfterId().

     

    These methods are useful to query for records before or after a given record. In the pull request author Tim MacDonald illustrates the following example to get the records around a “focused” post:

    $posts = new Collection;
    
    $posts = $posts->concat(ChatPost::forPageBeforeId(15, $focused->id)->get()->reverse());
    
    $posts = $posts->push($focused);
    
    $posts = $posts->concat(ChatPost::forPageAfterId(15, $focused->id)->get());

     

     

    You can see the full list of fixes below, and the whole difference  between 5.8.7 and 5.8.8 on GitHub.

     

    The full release notes for Laravel 5.8 are available in the GitHub 5.8 changelog:

     

    v5.8.8

    Added Added Illuminate\Database\Query\Builder::forPageBeforeId() method (#28011)


    Fixed

    BelongsToMany::detach() with custom pivot class (#27997)

    Fixed incorrect event namespace in generated listener by event:generate command (#28007)

     

    Fixed unique validation without ignored column (#27987)


    Changed

     

    Added parameters argument to resolve helper (#28020) Don’t add the path only if path is empty in compiled view (#27976)

     

    Refactoring

    Refactoring of env() helper (#27965)

    Continue Reading

    How to fix Flutterwave common error's while Integrating payment in your Laravel App

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: How to fix Flutterwave common error's while Integrating payment in your Laravel App [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl

    Hi folks, I was integrating FLutterwave on my laravel app, on the process i found a bunch of errors while trying to use it accept payment on my site. Have been a Paystack heavy user but decided to use Flutterwave for a reason that I love to do. Going through this article I will list the two types of error or bug that you must encounter while using Laravel Rave steps to get Flutterwave payment working.

    Types of error

    1. Error on the payment page when user try to refresh the page without making payment
    2. Error when a user successfully made the payment but you have callback issues

    How to fix this two type of errors


    First error Fixed -> Error on the payment page when user try to refresh the page without making paymment

    Your laravel Rave route for making payment is below:

    Route::post('/pay', 'R[email protected]')->name('pay');
    

    The error you will get when user refresh the payment page without making a payment is below:

    Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
    The GET method is not supported for this route. Supported methods: POST.
    

    The GET method is not supported for this route. Supported methods: POST.

    You get this error because your pay route is a post method

    Solved error

    You can solve this error by using matching route or create separate GET and POST route, where get route will redirect your user back to pay now button, but I choose to use match method in which user has to go back and click pay now button again because Flutterwave wouldn't see those post credential again., code below is for matching when the route have GET or POST method without showing a user those ugly codes

        Route::match(['GET', 'POST'],'/pay', '[email protected]')->name('pay');
    


    Second error Fixed ->  Error when a user successfully made the payment but you have callback issues

    This second error is when the user has successfully made payment whether success or not but you the developer want to do something with the returned data.

    Default Laravel Rave callback route

    Route::post('/rave/callback', '[email protected]')->name('callback');
    

    Error screen below:


    Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
    The GET method is not supported for this route. Supported methods: POST.
    http://127.0.0.1:4000/rave/callback?resp=%7B%22name%22%3A%22vbvcomplete%22%2C%22data%22%3A%7B%22transactionobject%22%3A%7B%22id%22%3A1441931%2C%22txRef%22%3A%22rave_5f246d0cb9dac%22%2C%22orderRef%22%3A%22URF_1596222756471_8337635%22%2C%22flwRef%22%3A%22FLW-MOCK-2aa82bc680c707b438cf9d2be8d30871%22%2C%22redirectUrl%22%3A%22http%3A%2F%2F127.0.0.1%3A4000%2Frave%2Fcallback%22%2C%22device_fingerprint%22%3A%22e5b87fff9ee84c0a929bf1e9fa408bb2%22%2C%22settlement_token%22%3Anull%2C%22cycle%22%3A%22one-time%22%2C%22amount%22%3A19.9999999999998%2C%22charged_amount%22%3A20%2C%22appfee%22%3A0.76%2C%22merchantfee%22%3A0%2C%22merchantbearsfee%22%3A1%2C%22chargeResponseCode%22%3A%2200%22%2C%22raveRef%22%3A%22RV3159622275508265EAA00C0E%22%2C%22chargeResponseMessage%22%3A%22Please%20enter%20the%20OTP%20sent%20to%20your%20mobile%20number%20080%2A%2A%2A%2A%2A%2A%20and%20email%20te%2A%2A%40rave%2A%2A.com%22%2C%22authModelUsed%22%3A%22VBVSECURECODE%22%2C%22currency%22%3A%22USD%22%2C%22IP%22%3A%22105.112.99.180%22%2C%22narration%22%3A%22CARD%20Transaction%20%22%2C%22status%22%3A%22successful%22%2C%22modalauditid%22%3A%22f90383b37b6e0e4194c6bb6f5573e0d2%22%2C%22vbvrespmessage%22%3A%22Approved.%20Successful%22%2C%22authurl%22%3A%22https%3A%2F%2Fravesandboxapi.flutterwave.com%2Fmockvbvpage%3Fref%3DFLW-MOCK-2aa82bc680c707b438cf9d2be8d30871%26code%3D00%26message%3DApproved.%20Successful%26receiptno%3DRN1596222756556%22%2C%22vbvrespcode%22%3A%2200%22%2C%22acctvalrespmsg%22%3Anull%2C%22acctvalrespcode%22%3A%22RN1596222756556%22%2C%22paymentType%22%3A%22card%22%2C%22paymentPlan%22%3A1%2C%22paymentPage%22%3Anull%2C%22paymentId%22%3A%226527778%22%2C%22fraud_status%22%3A%22ok%22%2C%22charge_type%22%3A%22normal%22%2C%22is_live%22%3A0%2C%22retry_attempt%22%3Anull%2C%22getpaidBatchId%22%3Anull%2C%22createdAt%22%3A%222020-07-31T19%3A12%3A36.000Z%22%2C%22updatedAt%22%3A%222020-07-31T19%3A12%3A46.000Z%22%2C%22deletedAt%22%3Anull%2C%22customerId%22%3A432208%2C%22AccountId%22%3A154719%2C%22customer%22%3A%7B%22id%22%3A432208%2C%22phone%22%3A%22%2B2348137140110%22%2C%22fullName%22%3A%22Kizito%20Adike%22%2C%22customertoken%22%3Anull%2C%22email%22%3A%22adikekizinho%40gmail.com%22%2C%22createdAt%22%3A%222020-07-31T19%3A12%3A35.000Z%22%2C%22updatedAt%22%3A%222020-07-31T19%3A12%3A35.000Z%22%2C%22deletedAt%22%3Anull%2C%22AccountId%22%3A154719%7D%2C%22chargeToken%22%3A%7B%22user_token%22%3A%22af107%22%2C%22embed_token%22%3A%22flw-t0-2d8204278bcb83865eedfbccc21980f1-m03k%22%7D%2C%22airtime_flag%22%3Afalse%7D%2C%22name%22%3A%22vbvcomplete%22%2C%22data%22%3A%7B%22status%22%3A%22successful%22%2C%22txRef%22%3A%22rave_5f246d0cb9dac%22%2C%22amount%22%3A%2219.9999999999998%22%7D%2C%22respcode%22%3A%2200%22%2C%22respmsg%22%3A%22Approved.%20Successful%22%7D%2C%22respcode%22%3A%2200%22%2C%22tx%22%3A%7B%22id%22%3A1441931%2C%22txRef%22%3A%22rave_5f246d0cb9dac%22%2C%22orderRef%22%3A%22URF_1596222756471_8337635%22%2C%22flwRef%22%3A%22FLW-MOCK-2aa82bc680c707b438cf9d2be8d30871%22%2C%22redirectUrl%22%3A%22http%3A%2F%2F127.0.0.1%3A4000%2Frave%2Fcallback%22%2C%22device_fingerprint%22%3A%22e5b87fff9ee84c0a929bf1e9fa408bb2%22%2C%22settlement_token%22%3Anull%2C%22cycle%22%3A%22one-time%22%2C%22amount%22%3A19.9999999999998%2C%22charged_amount%22%3A20%2C%22appfee%22%3A0.76%2C%22merchantfee%22%3A0%2C%22merchantbearsfee%22%3A1%2C%22chargeResponseCode%22%3A%2200%22%2C%22raveRef%22%3A%22RV3159622275508265EAA00C0E%22%2C%22chargeResponseMessage%22%3A%22Please%20enter%20the%20OTP%20sent%20to%20your%20mobile%20number%20080%2A%2A%2A%2A%2A%2A%20and%20email%20te%2A%2A%40rave%2A%2A.com%22%2C%22authModelUsed%22%3A%22VBVSECURECODE%22%2C%22currency%22%3A%22USD%22%2C%22IP%22%3A%22105.112.99.180%22%2C%22narration%22%3A%22CARD%20Transaction%20%22%2C%22status%22%3A%22successful%22%2C%22modalauditid%22%3A%22f90383b37b6e0e4194c6bb6f5573e0d2%22%2C%22vbvrespmessage%22%3A%22Approved.%20Successful%22%2C%22authurl%22%3A%22https%3A%2F%2Fravesandboxapi.flutterwave.com%2Fmockvbvpage%3Fref%3DFLW-MOCK-2aa82bc680c707b438cf9d2be8d30871%26code%3D00%26message%3DApproved.%20Successful%26receiptno%3DRN1596222756556%22%2C%22vbvrespcode%22%3A%2200%22%2C%22acctvalrespmsg%22%3Anull%2C%22acctvalrespcode%22%3A%22RN1596222756556%22%2C%22paymentType%22%3A%22card%22%2C%22paymentPlan%22%3A1%2C%22paymentPage%22%3Anull%2C%22paymentId%22%3A%226527778%22%2C%22fraud_status%22%3A%22ok%22%2C%22charge_type%22%3A%22normal%22%2C%22is_live%22%3A0%2C%22retry_attempt%22%3Anull%2C%22getpaidBatchId%22%3Anull%2C%22createdAt%22%3A%222020-07-31T19%3A12%3A36.000Z%22%2C%22updatedAt%22%3A%222020-07-31T19%3A12%3A46.000Z%22%2C%22deletedAt%22%3Anull%2C%22customerId%22%3A432208%2C%22AccountId%22%3A154719%2C%22customer%22%3A%7B%22id%22%3A432208%2C%22phone%22%3A%22%2B2348137140110%22%2C%22fullName%22%3A%22Kizito%20Adike%22%2C%22customertoken%22%3Anull%2C%22email%22%3A%22adikekizinho%40gmail.com%22%2C%22createdAt%22%3A%222020-07-31T19%3A12%3A35.000Z%22%2C%22updatedAt%22%3A%222020-07-31T19%3A12%3A35.000Z%22%2C%22deletedAt%22%3Anull%2C%22AccountId%22%3A154719%7D%2C%22chargeToken%22%3A%7B%22user_token%22%3A%22af107%22%2C%22embed_token%22%3A%22flw-t0-2d8204278bcb83865eedfbccc21980f1-m03k%22%7D%2C%22airtime_flag%22%3Afalse%7D%2C%22respmsg%22%3A%22Approved.%20Successful%22%7D
    

    How to fix these error

    changing callback from post to get

       Route::get('/rave/callback', '[email protected]')->name('callback');
    

    Now you wouldn't be able to get those data from flutterwave because this will return null, you have to do something on your callback function

    default laravel Rave callback function

    namespace App\Http\Controllers;
    
    
    
    
    use Illuminate\Http\Request;
    
    use Rave;
    
    
    
    
    class PaymentController extends Controller {
    
    
    
    
      public function initialize() {
    
        Rave::initialize(route('callback'));
    
      }
    
    
    
    
      public function callback() {
    
    
    
    
        $data = Rave::verifyTransaction(request()->txref);
    
    
    
    
        dd($data);
    
         
    
    
    
    
      }
    
    
    
    
    }
    

    Now you have to modify it to be able to receive the payment data's

    code below

    namespace App\Http\Controllers;
    
    
    use Illuminate\Http\Request;
    use Rave;
    
    
    class PaymentController extends Controller {
    
    
        public function initialize() {
            Rave::initialize(route('callback'));
        }
    
    
        public function callback(Request $request) {
            $resp = $request->resp;
            $body = json_decode($resp, true);
            $txRef = $body['data']['data']['txRef'];
            $data = Rave::verifyTransaction($txRef);
            dd($data);
        }
    
    
    }
    
    
    


    After that, you now get those datas and do something, love this buy me a beer

    Continue Reading

    Easy way to Host your Laravel Application on Shared Hosting

    kizinho

    Published

    on

    DEVELOPER PROGRAMMING: Easy way to Host your Laravel Application on Shared Hosting [New  Developer Programming] » Naijacrawl
    Photo: Naijacrawl

    Hi , Folks have you finished building that your awesome project but hosting it o shared hosting is what remains, don't worry you are on the right track, I have the best way to do that.

    Steps

    1. Create Database on your online cpanel
    2. Upload your project or use git to do that
    3. Set everything up on your ENV
    4. now we need .htaccess that you will create inside your laravel root folder


    Inside the .htaccess add this code

    RewriteEngine On#endsRewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /public/$1RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
    RewriteRule ^(/)?$ public/index.php [L]

    Replace with your domain

    What this code does is that when you host your laravel application and access it, it will show the user the original folder of your project, unless you go to the public before it can load the project as a web but now enjoy hosting with shared hosting after following the above steps.

    Enjoy and share

    Continue Reading

    Latest