アプリ関連ニュース

Sanitizing and formatting data with the Transformer PHP package

Transformer is a PHP package for sanitizing and formatting data powered by Laravel’s validation components. The package uses a familiar Laravel validation-like syntax to transform data using classes, callable functions and etc.

Here is a quick sample.

$input = [
  'name' => '  yuuma  ',
  'phone_number' => '123-4567-7891',
  'date_of_birth' => "1998-04-12",
];

(new DataTransformer($input, [
    'name' => 'trim|ucfirst',
    'phone_number' => 'only_numbers',
    'date_of_birth' => 'to_carbon|->format:m/d/y',
]))->transform();

// Returns:
// [
//     "name" => "Yuuma",
//     "phone_number" => "12345677891",
//     "date_of_birth" => "04/12/98",
// ]

Data can also be transformed using closures or classes that implement the provided Transformable interface. Additionally, this package supports nested array data using dot notation, wildcard input (applying functions to keys matching a wildcard pattern), and more.

Learn more about this package, get full installation instructions, and view the source code on GitHub.

Yuuma



Log Viewer library for Laravel

Today, I would like to share just a library for viewing logs in Laravel. Let’s take a look.

The library’s name is Log Viewer. This library is very cool to see Laravel log entries clearly and quickly. And you can also search and filter the logs, and each log entry is shareable links.

I’m sure that this library make developers efficient to work for debugging or something like using log files.

You can check out for more details here.

This is all for now. Hope you enjoy that.

By Asahi



Flutterで水平方向の点線を作成する方法

Flutterで水平のダッシュや点線がうまく描けない場合は、以下の例を参照してください。

線を引きたいときは、CustomPaint機能を使って、いろいろな線を描いてみましょう。

水平線はCanvas上でのdrawLineという機能でoffsetを設定され、描画されます。

コード

return Scaffold(
      appBar: AppBar(
        title: Text("Horizontal Dotted/Dash Line"), 
        backgroundColor: Colors.blueAccent, 
      ),
      body: Container(
        color: Colors.white,
        height: 150.0, 
        child: Center(
          child:CustomPaint(painter: DrawDottedhorizontalline()),
        ),
      ),
    );
class DrawDottedhorizontalline extends CustomPainter {
  late Paint _paint;
  DrawDottedhorizontalline() {
    _paint = Paint();
    _paint.color = Colors.black; //dots color
    _paint.strokeWidth = 2; //dots thickness
    _paint.strokeCap = StrokeCap.square; //dots corner edges
  }

  @override
  void paint(Canvas canvas, Size size) {
    for (double i = -300; i < 300; i = i + 15) {
      // 15 is space between dots
      if (i % 2 == 0) {
        canvas.drawLine(Offset(i, 0), Offset(i + 20, 0.0), _paint);
      }
    }
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) {
    return false;
  }
}

結果

金曜担当 – Ami



Five most used PHP Testing frameworks

Today, I would like to share about some popular PHP testing frameworks.

There are many automated testing frameworks in PHP. Among them, I will list down 5 most used frameworks. Let’s take a look.

1. PHPUnit

2. PHPSPec

3. StoryPlayer

4. Codeception

5. Behat

You can check by clicking each list item for more details.

This is all for now. Hope you enjoy that.

By Asahi



Flutterでアドレス、件名、本文のあるメールアプリケーションを開く方法

今回は自分のメールアプリをFlutterの方から開く方法を紹介します。

まずは、pubspec.yamlで開く必要があるpackageを追加します。

 url_launcher: ^6.1.5

アドレス、件名、本文を指定してメールアプリを開く方法

String email = Uri.encodeComponent("mail@fluttercampus.com");
String subject = Uri.encodeComponent("Nice to meet u Flutter Team");
String body = Uri.encodeComponent("Hello!I'm Flutter Developer");
Uri mail = Uri.parse("mailto:$email?subject=$subject&body=$body");
if (await launchUrl(mail)) {
    
}else{
    
}

ボタンをタップする時、上記のことをコールます。

ElevatedButton(
  onPressed: ()async{
       //上記のことをコール
    },
child: Text("今すぐメールを送る")
);



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム